template: add metadata to the html head
Expose metadata in a way that Zotero can read, so Dublin Core and Open Graph are an easy way. No so easy, but still. The language attribute of the html tag has been correctly set. In the process, the date test has been improved. Closes #3 Co-Authored-by: Igor Milhit <igor@milhit.ch>pull/31/head 0.1.0
parent
7b43ee60e5
commit
10fefee380
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="{{ .Language.Lang }}" prefix="og: http://ogp.me/ns#">
|
||||
{{- partial "head.html" . -}}
|
||||
<body>
|
||||
{{- partial "header.html" . -}}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ .Title }} | {{ .Site.Title }}</title>
|
||||
<link rel="canonical" href="{{ .Permalink }}">
|
||||
{{- partial "metadata.html" . -}}
|
||||
{{ if .Site.IsServer }}
|
||||
{{ $options := (dict "targetPath" "styles.css" "enableSourceMap" true) }}
|
||||
{{ $styles := resources.Get "scss/main.scss" | toCSS $options }}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
{{ if .IsPage }}
|
||||
/ <a href="{{ .Site.BaseURL }}index.xml"><span class="smallcaps">rss</a>
|
||||
{{ end }}
|
||||
|
||||
</nav>
|
||||
</section>
|
||||
</header>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
|
||||
<link rel="schema.DCTERMS" href="http://purl.org/dc/terms/">
|
||||
<meta property="og:site_name" content="{{ .Site.Title }}">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
<meta name="DC.creator" content="{{ .Site.Author.name }}">
|
||||
<meta name="DC.language" content="{{ .Language.Lang }}">
|
||||
{{ if .IsNode }}
|
||||
<meta name="DC.title" content="{{ .Site.Title }}">
|
||||
{{ end }}
|
||||
{{ if .IsPage }}
|
||||
<meta name="DC.type" content="blogPost">
|
||||
<meta name="DC.title" content="{{ .Page.Title }}">
|
||||
<meta name="DC.created"
|
||||
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
|
||||
<meta name="DC.date"
|
||||
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
|
||||
{{ if (and (isset .Params "lastmod") (gt (dateFormat "2016-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
|
||||
<meta name="DC.modified" content="{{ .Lastmod }}">
|
||||
{{ end }}
|
||||
<meta name="og:article:published_time"
|
||||
content="{{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}">
|
||||
{{ if (and (isset .Params "lastmod") (gt (dateFormat "2016-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
|
||||
<meta name="og.article:modified_time" content="{{ .Lastmod }}">
|
||||
{{ end }}
|
||||
{{ with .Params.categories }}
|
||||
{{ range . }}
|
||||
<meta name="DC.subject" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with .Params.tags }}
|
||||
{{ range . }}
|
||||
<meta name="DC.subject" content="{{ . }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
|
@ -1,9 +1,6 @@
|
|||
{{ $LastmodFormatted := dateFormat "2006-01-02" (.Lastmod) }}
|
||||
{{ $PublishdateFormatted := dateFormat "2006-01-02" (.PublishDate) }}
|
||||
|
||||
<ul class="post-info">
|
||||
<li>Publié le : {{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}</li>
|
||||
{{ if (and (isset .Params "lastmod") (gt $LastmodFormatted $PublishdateFormatted)) }}
|
||||
{{ if (and (isset .Params "lastmod") (gt (dateFormat "2006-01-02" (.Lastmod)) (dateFormat "2006-01-02" (.PublishDate)))) }}
|
||||
<li>Dernière mise à jour : {{ .Lastmod.Format "2006-01-02" }}</li>
|
||||
{{ end }}
|
||||
{{ with .Params.categories }}
|
||||
|
|
Loading…
Reference in New Issue