Added RSS feed link in nav menu, prevented docs section from showing up in the home page feed and tweaked the title of the home page feed to not have the "Home on <website>" title, juste <website>.
This commit is contained in:
parent
8d4bb3881d
commit
72307e55ee
3 changed files with 47 additions and 1 deletions
|
@ -16,6 +16,10 @@
|
||||||
{{- $allCss := slice $base $header $home $pagination $footer | resources.Concat "css/all.css" | fingerprint | minify -}}
|
{{- $allCss := slice $base $header $home $pagination $footer | resources.Concat "css/all.css" | fingerprint | minify -}}
|
||||||
<link rel="stylesheet" href="{{ $allCss.Permalink }}">
|
<link rel="stylesheet" href="{{ $allCss.Permalink }}">
|
||||||
|
|
||||||
|
{{ range .AlternativeOutputFormats -}}
|
||||||
|
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
|
||||||
|
{{ end -}}
|
||||||
|
|
||||||
<title>{{ $title }}</title>
|
<title>{{ $title }}</title>
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
</head>
|
</head>
|
||||||
|
|
41
layouts/_default/rss.xml
Normal file
41
layouts/_default/rss.xml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{{- $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 or (eq .Title .Site.Title) (eq .Title "Home") }}{{ .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 "2006-01-02" | safeHTML }}</lastBuildDate>{{ end }}{{- with .OutputFormats.Get "RSS" -}}{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||||
|
{{- end -}}
|
||||||
|
{{ range $pages }}
|
||||||
|
{{ if ( ne .Section "docs" ) }}
|
||||||
|
<item>
|
||||||
|
<title>{{ .Title }}</title>
|
||||||
|
<link>{{ .Permalink }}</link>
|
||||||
|
<pubDate>{{ .Date.Format "2006-01-02" | safeHTML }}</pubDate>
|
||||||
|
{{ with .Site.Author.email }}
|
||||||
|
<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>
|
||||||
|
{{end}}
|
||||||
|
<guid>{{ .Permalink }}</guid>
|
||||||
|
<description>{{ .Summary | html }}</description>
|
||||||
|
</item>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</channel>
|
||||||
|
</rss>
|
|
@ -2,6 +2,7 @@
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="nav-menu-title"><a href="/">{{ .Site.Title }}</a></li>
|
<li class="nav-menu-title"><a href="/">{{ .Site.Title }}</a></li>
|
||||||
|
<li><a href="/index.xml">RSS</a></li>
|
||||||
{{- $p := . -}}
|
{{- $p := . -}}
|
||||||
{{- range .Site.Menus.main.ByWeight -}}
|
{{- range .Site.Menus.main.ByWeight -}}
|
||||||
{{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
|
{{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
{{- $url := urls.Parse .URL -}}
|
{{- $url := urls.Parse .URL -}}
|
||||||
{{- $baseurl := urls.Parse $.Site.Params.Baseurl -}}
|
{{- $baseurl := urls.Parse $.Site.Params.Baseurl -}}
|
||||||
<li>
|
<li>
|
||||||
<a class="{{if $active }}nav-menu-active{{end}}" href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a>
|
<a{{if $active }} class="nav-menu-active"{{end}} href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Add table
Reference in a new issue