Verified Commit 7d856348 authored by Tomáš Zemanovič's avatar Tomáš Zemanovič
Browse files

add metadata field for canonical url

parent 605d2613
......@@ -101,16 +101,19 @@ postCtx =
dateField "date" "%B %e, %Y" <>
constField "active-blog" "y" <>
ertField "ert" <>
metaKeywordCtx <>
metaKeywordsCtx <>
canonicalUrlCtx <>
defaultContext
metaKeywordCtx :: Context String
metaKeywordCtx = field "metaKeywords" $ \item -> do
tags <- getMetadataField (itemIdentifier item) "tags"
return $ maybe "" showMetaTags tags
where
showMetaTags t = "<meta name=\"keywords\" content=\"" ++ t ++ "\"/>\n"
metaKeywordsCtx :: Context String
metaKeywordsCtx = field "meta-keywords" $ \item -> do
getMetadataField' (itemIdentifier item) "tags"
canonicalUrlCtx :: Context String
canonicalUrlCtx = field "canonical-url" $ \item -> do
getMetadataField' (itemIdentifier item) "canonical-url"
-- estimated reading time
......
......@@ -6,7 +6,11 @@
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="Tomáš Zemanovič" />
$if(metaKeywords)$ $metaKeywords$ $endif$
$if(meta-keywords)$
<meta name="keywords" content="$meta-keywords$" />
$endif$ $if(canonical-url)$
<link rel="canonical" href="$canonical-url$" />
$endif$
<meta name="theme-color" content="#10151f" />
<meta
name="google-site-verification"
......
......@@ -14,7 +14,11 @@
$ert$
</div>
</div>
<div id="post-body" class="pure-u">$body$</div>
<div id="post-body" class="pure-u">
$if(canonical-url)$
<em>Originally posted at <a href="$canonical-url$">$canonical-url$</a>.</em
><br />$endif$ $body$
</div>
<div id="post-footer" class="social-share tooltips">
<a href="/" title="back"><i class="fas fa-arrow-circle-left"></i> back</a>
<a
......
name: tzemanovic
version: 1.0.0.0
version: 1.0.1.0
synopsis: Blog website
description: Please see README.md
homepage: https://gitlab.com/tzemanovic/tzemanovic.gitlab.io
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment