From b6cb7d009364ab63e09fe6febc15330edae0644a Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Fri, 28 Aug 2020 22:21:11 +0200 Subject: Move site title after page title Plenty of websites do this; on GNU/Linux most applications do this; I guess the goal is to make the most specific information go first, so that tabs remain identifiable as they become narrower. --- repo/www/TODO | 1 - repo/www/generate-index.py | 6 ++++-- repo/www/generate-page.py | 4 ++-- repo/www/helpers.py | 6 ++---- repo/www/template.html | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) (limited to 'repo') diff --git a/repo/www/TODO b/repo/www/TODO index 5759e87..cd97605 100644 --- a/repo/www/TODO +++ b/repo/www/TODO @@ -1,5 +1,4 @@ - compute "leak count" on toplevel index -- use "{pagetitle} - {sitetitle})" for - get stylin' - pandoc template - tufte css? at least sidenotes rather than footnotes diff --git a/repo/www/generate-index.py b/repo/www/generate-index.py index 3bce69d..16d1874 100755 --- a/repo/www/generate-index.py +++ b/repo/www/generate-index.py @@ -100,6 +100,8 @@ def main(arguments): variables = {'crumbs': generate_crumbs(Path(target)/'index')} metadata = {} + if arguments.site_title is not None: + metadata['sitetitle'] = arguments.site_title if readme is not None: repo_top = Repo(search_parent_directories=True).working_dir @@ -118,7 +120,7 @@ def main(arguments): pandoc( readme_path, arguments.output, arguments.template, arguments.filters, stylesheets, - site_title=arguments.site_title, include_after=(toc.name,), + include_after=(toc.name,), variables=variables, metadata=metadata ) return @@ -134,7 +136,7 @@ def main(arguments): pandoc( dummy_readme.name, arguments.output, arguments.template, arguments.filters, stylesheets, - site_title=arguments.site_title, include_after=(toc.name,), + include_after=(toc.name,), variables=variables, metadata=metadata ) diff --git a/repo/www/generate-page.py b/repo/www/generate-page.py index 967689e..cb2317b 100755 --- a/repo/www/generate-page.py +++ b/repo/www/generate-page.py @@ -50,9 +50,9 @@ def main(arguments): arguments.template, arguments.filters, stylesheets, - site_title=arguments.site_title, variables={'crumbs': generate_crumbs(page_path)}, - metadata={'pagetitle':arguments.title} + metadata={'pagetitle': arguments.title, + 'sitetitle': arguments.site_title} ) diff --git a/repo/www/helpers.py b/repo/www/helpers.py index 3d412b4..48ebccf 100644 --- a/repo/www/helpers.py +++ b/repo/www/helpers.py @@ -56,8 +56,8 @@ def deserialize_directories(directories): } -def pandoc(page, output, template, filters, stylesheets, site_title=None, - include_after=(), variables=None, metadata=None): +def pandoc(page, output, template, filters, stylesheets, include_after=(), + variables=None, metadata=None): cmd = ( 'pandoc', '-s', page, '-o', output, '--template', template, *chain(*(('--lua-filter', f) for f in filters)), @@ -65,8 +65,6 @@ def pandoc(page, output, template, filters, stylesheets, site_title=None, *chain(*(('--include-after-body', f) for f in include_after)) ) - if site_title is not None: - cmd += ('-T', site_title) if variables is not None: cmd += tuple(chain( *(('-V', f'{k}={v}') for k, v in variables.items()) diff --git a/repo/www/template.html b/repo/www/template.html index 3417e93..b4746d9 100644 --- a/repo/www/template.html +++ b/repo/www/template.html @@ -13,7 +13,7 @@ $endif$ $if(keywords)$ <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> $endif$ - <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$ + $pagetitle$$if(sitetitle)$ – $sitetitle$$endif$ -- cgit v1.2.3