diff options
-rw-r--r-- | archetypes/default.md | 18 | ||||
-rw-r--r-- | layouts/_default/list.html | 2 | ||||
-rw-r--r-- | layouts/_default/list.xml | 39 | ||||
-rw-r--r-- | layouts/index.atom.xml | 36 | ||||
-rw-r--r-- | layouts/index.html | 4 | ||||
-rw-r--r-- | layouts/index.rss.xml | 39 | ||||
-rw-r--r-- | layouts/micro/index.html | 2 | ||||
-rw-r--r-- | layouts/micro/list.html | 2 | ||||
-rw-r--r-- | layouts/sitemap.xml | 22 |
9 files changed, 157 insertions, 7 deletions
diff --git a/archetypes/default.md b/archetypes/default.md index ac36e06..1f90818 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,2 +1,16 @@ -+++ -+++ +--- +author: +type: post +date: {{ .Date }} +lastmod: + +tags: + - tag +topics: + - topic +keywords: + - keyword + +description: "" +title: "" +--- diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e69e3bf..7863d64 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -3,7 +3,7 @@ {{ .Content }} <ul class="contents"> - {{ range .Paginator.Pages }} + {{ range where .Paginator.Pages "Params.hidden" "ne" "true" }} <li>{{.Title}} <div> {{ .Summary }} diff --git a/layouts/_default/list.xml b/layouts/_default/list.xml new file mode 100644 index 0000000..849e0f0 --- /dev/null +++ b/layouts/_default/list.xml @@ -0,0 +1,39 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + {{ with .OutputFormats.Get "RSS" }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{ end }} + {{ range where $pages "Params.hidden" "ne" "true" }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description>{{ .Summary | html }}</description> + </item> + {{ end }} + </channel> +</rss> diff --git a/layouts/index.atom.xml b/layouts/index.atom.xml new file mode 100644 index 0000000..7443f34 --- /dev/null +++ b/layouts/index.atom.xml @@ -0,0 +1,36 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +<feed xmlns="http://www.w3.org/2005/Atom"> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link href="{{ .Permalink }}feed.xml" rel="self"/> + <link href="{{ .Permalink }}"/>{{ if not .Date.IsZero }} + <updated>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>{{end}} + <id>{{ .Permalink }}</id>{{ with .Site.Author.name }} + <author> + <name>{{.}}</name>{{ with $.Site.Author.email }} + <email>{{.}}</email>{{end}} + </author>{{end}} + <generator>Hugo -- gohugo.io</generator> + {{ range where $pages "Params.hidden" "ne" "true" }} + <entry> + {{ `<title type="html"><![CDATA[` | safeHTML }}{{ .Title }}]]></title> + <link href="{{ .Permalink }}"/> + <id>{{ .Permalink }}</id>{{ with .Site.Params.Author }} + <author> + <name>{{.}}</name> + </author>{{end}} + <published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published> + <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated> + {{ `<content type="html"><![CDATA[` | safeHTML }}{{ .Content }}]]></content> + </entry>{{ end }} +</feed> diff --git a/layouts/index.html b/layouts/index.html index 7516cf1..e6fbc13 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -19,11 +19,11 @@ </div> <div class="archive"> <h2>Archive</h2> - {{ range (where .Site.RegularPages "Type" "post").GroupByDate "2006" }} + {{ range (where (where .Site.RegularPages "Params.hidden" "ne" "true") "Type" "post").GroupByDate "2006" }} <h3 class="archive-title">{{ .Key }}</h3> {{ range .Pages }} <article class="list-item"> - <a href="{{ .Permalink }}" class="list-item-link">{{ .Title }}</a> + <a href="{{ .RelPermalink }}" class="list-item-link">{{ .Title }}</a> <span class="list-item-date">{{ .Date.Format "January 2, 2006" }}</span> </article> {{ end }} diff --git a/layouts/index.rss.xml b/layouts/index.rss.xml new file mode 100644 index 0000000..849e0f0 --- /dev/null +++ b/layouts/index.rss.xml @@ -0,0 +1,39 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + {{ with .OutputFormats.Get "RSS" }} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{ end }} + {{ range where $pages "Params.hidden" "ne" "true" }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description>{{ .Summary | html }}</description> + </item> + {{ end }} + </channel> +</rss> diff --git a/layouts/micro/index.html b/layouts/micro/index.html index e69e3bf..e4fd6ee 100644 --- a/layouts/micro/index.html +++ b/layouts/micro/index.html @@ -6,7 +6,7 @@ {{ range .Paginator.Pages }} <li>{{.Title}} <div> - {{ .Summary }} + {{ .Summary }} </div> </li> {{ end }} diff --git a/layouts/micro/list.html b/layouts/micro/list.html index 030d847..de07f99 100644 --- a/layouts/micro/list.html +++ b/layouts/micro/list.html @@ -18,6 +18,6 @@ </article> {{ end }} {{ end }} -</div> +</div> </main> {{ partial "footer" . }} diff --git a/layouts/sitemap.xml b/layouts/sitemap.xml new file mode 100644 index 0000000..d5ae26e --- /dev/null +++ b/layouts/sitemap.xml @@ -0,0 +1,22 @@ +{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }} +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" + xmlns:xhtml="http://www.w3.org/1999/xhtml"> + {{ range where .Data.Pages "Params.hidden" "ne" "true" }} + <url> + <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} + <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }} + <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }} + <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }} + <xhtml:link + rel="alternate" + hreflang="{{ .Lang }}" + href="{{ .Permalink }}" + />{{ end }} + <xhtml:link + rel="alternate" + hreflang="{{ .Lang }}" + href="{{ .Permalink }}" + />{{ end }} + </url> + {{ end }} +</urlset> |