File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -157,9 +157,9 @@ def create_navigation(current_path):
157157 title = data ["title" ]
158158
159159 if current_path == data ["outpath" ]:
160- text += f'<a href="{ url } " class="navigation-item active">{ title } </a>\n '
160+ text += f'<a href="#_content " class="navigation-item active">{ title } </a>\n '
161161 else :
162- text += f'<a href="{ url } " class="navigation-item">{ title } </a>\n '
162+ text += f'<a href="{ url } #_content " class="navigation-item">{ title } </a>\n '
163163
164164 return text
165165
Original file line number Diff line number Diff line change 2727 </ div >
2828 < div class ="sidebar-version "> Bosca Ceoil Blue v%BOSCA_VERSION%</ div >
2929 </ div >
30- < div class ="content ">
30+ < div class ="content " id =" _content " >
3131%PAGE_CONTENT%
3232 </ div >
3333 </ div >
Original file line number Diff line number Diff line change 99import xml .etree .ElementTree as etree
1010
1111
12+ # Convert link and image paths that start with "/" to absolute paths using configured base.
1213class AbsoluteLinkProcessor (Treeprocessor ):
1314 def __init__ (self , md , config ):
1415 super ().__init__ (md )
@@ -24,7 +25,13 @@ def run(self, root: etree.Element):
2425 def update_links (self , root : etree .Element ):
2526 for el in root .iter ("a" ):
2627 if "href" in el .attrib and el .attrib ["href" ].startswith ("/" ):
27- el .attrib ["href" ] = self .base_path + el .attrib ["href" ]
28+ path = self .base_path + el .attrib ["href" ]
29+ # Make sure the content is immediately visible on mobile, but only
30+ # if there are no other hashes in the URL.
31+ if path .endswith (".html" ):
32+ path += "#_content"
33+
34+ el .attrib ["href" ] = path
2835
2936
3037 def update_images (self , root : etree .Element ):
You can’t perform that action at this time.
0 commit comments