include canonical link in meta tags

This commit is contained in:
Colin McMillen 2021-06-28 15:10:39 -04:00
parent e06ac521c6
commit 1af686a630
2 changed files with 8 additions and 1 deletions

View File

@ -52,11 +52,17 @@ for markdown_filename in glob.glob(os.path.join(input_directory, '*.md')):
if markdown_filename == os.path.join(input_directory, 'index.md'): if markdown_filename == os.path.join(input_directory, 'index.md'):
title = 'Colin McMillen' title = 'Colin McMillen'
out_filename = os.path.basename(markdown_filename).replace('.md', '.html')
html = markdown.markdown(text, extensions=md_extensions, output_format='html5') html = markdown.markdown(text, extensions=md_extensions, output_format='html5')
output = template.replace('__TITLE_GOES_HERE__', title) output = template.replace('__TITLE_GOES_HERE__', title)
output = output.replace('__CONTENT_GOES_HERE__', html) output = output.replace('__CONTENT_GOES_HERE__', html)
out_filename = os.path.basename(markdown_filename).replace('.md', '.html') page_url = out_filename
if page_url.endswith('index.html'): # strip off index.html
page_url = page_url[:-len('index.html')]
output = output.replace('__PAGE_URL_GOES_HERE__', page_url)
out_filenames.append(out_filename) out_filenames.append(out_filename)
out_fullpath = os.path.join(output_directory, out_filename) out_fullpath = os.path.join(output_directory, out_filename)
print_file(markdown_filename, out_fullpath) print_file(markdown_filename, out_fullpath)

View File

@ -13,6 +13,7 @@
<link rel="stylesheet" href="/pygments.css"> <link rel="stylesheet" href="/pygments.css">
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/style.css">
<link rel="icon" type="image/png" href="/favicon-32.png"> <link rel="icon" type="image/png" href="/favicon-32.png">
<link rel="canonical" href="https://www.mcmillen.dev/__PAGE_URL_GOES_HERE__">
<!-- TODO: add apple touch icon, maybe other favicon sizes --> <!-- TODO: add apple touch icon, maybe other favicon sizes -->
</head> </head>