diff --git a/archivebox/archive_methods.py b/archivebox/archive_methods.py index acf332a4..105c39b7 100644 --- a/archivebox/archive_methods.py +++ b/archivebox/archive_methods.py @@ -119,9 +119,9 @@ def archive_link(link: Link, link_dir: Optional[str]=None) -> Link: # print(' ', stats) - # If any changes were made, update the link index json and html write_link_index(link, link_dir=link.link_dir) + # If any changes were made, update the main links index json and html was_changed = stats['succeeded'] or stats['failed'] if was_changed: patch_links_index(link) diff --git a/archivebox/index.py b/archivebox/index.py index d7e230a3..b3cd350e 100644 --- a/archivebox/index.py +++ b/archivebox/index.py @@ -17,6 +17,8 @@ from .config import ( from .util import ( merge_links, urlencode, + htmlencode, + urldecode, derived_link_info, wget_output_path, enforce_types, @@ -267,12 +269,13 @@ def write_html_link_index(link: Link, link_dir: Optional[str]=None) -> None: path = os.path.join(link_dir, 'index.html') - html_index = Template(link_html).substitute({ + template_vars: Mapping[str, str] = { **derived_link_info(link), 'title': ( link.title or (link.base_url if link.is_archived else TITLE_LOADING_MSG) ), + 'url_str': htmlencode(urldecode(link.base_url)), 'archive_url': urlencode( wget_output_path(link) or (link.domain if link.is_archived else 'about:blank') @@ -281,6 +284,8 @@ def write_html_link_index(link: Link, link_dir: Optional[str]=None) -> None: 'tags': link.tags or 'untagged', 'status': 'archived' if link.is_archived else 'not yet archived', 'status_color': 'success' if link.is_archived else 'danger', - }) + } + + html_index = Template(link_html).substitute(**template_vars) atomic_write(html_index, path) diff --git a/archivebox/templates/index.html b/archivebox/templates/index.html index 144f2ce7..6b40000a 100644 --- a/archivebox/templates/index.html +++ b/archivebox/templates/index.html @@ -1,7 +1,8 @@ + - Archived Sites +