mirror of
https://github.com/yrzam/yrzam-hugo-theme.git
synced 2025-04-19 04:09:10 +00:00
rss
This commit is contained in:
parent
a6ba623f08
commit
25134fdcf3
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
linkTitle: "{{ .File.ContentBaseName | humanize | lower }}"
|
linkTitle: "{{ .File.ContentBaseName | humanize | lower }}"
|
||||||
title: "{{ .File.ContentBaseName | humanize }}"
|
title: "{{ .File.ContentBaseName | humanize }}"
|
||||||
|
outputs: [html]
|
||||||
---
|
---
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
theme: yrzam
|
theme: yrzam
|
||||||
|
|
||||||
# SITE INFO
|
# SITE SETTINGS
|
||||||
baseURL:
|
baseURL:
|
||||||
title:
|
title:
|
||||||
languageCode:
|
languageCode:
|
||||||
@ -8,9 +8,8 @@ taxonomies:
|
|||||||
# Create these per each section&taxo, replacing section
|
# Create these per each section&taxo, replacing section
|
||||||
# with section name and taxo with taxonomy name
|
# with section name and taxo with taxonomy name
|
||||||
section_taxo: section/taxo
|
section_taxo: section/taxo
|
||||||
|
|
||||||
# SITE SETTINGS
|
|
||||||
params:
|
params:
|
||||||
|
email:
|
||||||
dateFormat: "2006-01-02T15:04:05Z"
|
dateFormat: "2006-01-02T15:04:05Z"
|
||||||
dateFormatShort: "2006-01-02"
|
dateFormatShort: "2006-01-02"
|
||||||
paginationAdjacentLinks: 2
|
paginationAdjacentLinks: 2
|
||||||
@ -19,6 +18,14 @@ paginate: 50
|
|||||||
# GENERATOR SETTINGS
|
# GENERATOR SETTINGS
|
||||||
capitalizeListTitles: false
|
capitalizeListTitles: false
|
||||||
disableHugoGeneratorInject: true
|
disableHugoGeneratorInject: true
|
||||||
disableKinds: [RSS, sitemap, taxonomy]
|
disableKinds: [sitemap]
|
||||||
|
outputs:
|
||||||
|
home: [html]
|
||||||
|
section: [html, rss]
|
||||||
|
taxonomy: []
|
||||||
|
term: [html]
|
||||||
|
outputFormats:
|
||||||
|
RSS:
|
||||||
|
baseName: rss
|
||||||
minify:
|
minify:
|
||||||
minifyOutput: true
|
minifyOutput: true
|
@ -4,12 +4,15 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<title>{{ if not .IsHome }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
|
<title>{{ if not .IsHome }}{{ .LinkTitle | humanize }} - {{ end }}{{ .Site.Title }}</title>
|
||||||
{{ $opts := dict "transpiler" "libsass" "targetPath" "style.css" }}
|
{{ $opts := dict "transpiler" "libsass" "targetPath" "style.css" }}
|
||||||
{{ with resources.Get "css/index.scss" | toCSS $opts | minify | fingerprint }}
|
{{ with resources.Get "css/index.scss" | toCSS $opts | minify | fingerprint }}
|
||||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" />
|
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
|
{{ with .OutputFormats.Get "rss" -}}
|
||||||
|
{{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
|
||||||
|
{{ end }}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{ block "body" . }}
|
{{ block "body" . }}
|
||||||
|
@ -34,7 +34,9 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{ define "footer" }}
|
{{ define "footer" }}
|
||||||
<!--div class="content">
|
<div class="content">
|
||||||
<a href="">subscribe</a>
|
{{ with .OutputFormats.Get "rss" -}}
|
||||||
</div-->
|
{{ printf `<a rel="%s" href="%s">subscribe</a>` .Rel .Permalink | safeHTML }}
|
||||||
|
{{ end -}}
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
36
layouts/_default/rss.xml
Normal file
36
layouts/_default/rss.xml
Normal file
@ -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 -}}
|
||||||
|
{{- 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>{{ .Site.Title }}{{ if not .IsHome }}: {{ .LinkTitle | humanize }}{{ end }}</title>
|
||||||
|
<link>{{ .Permalink }}</link>
|
||||||
|
<language>{{ site.Language.LanguageCode }}</language>{{ if site.Params.email }}
|
||||||
|
<managingEditor>{{ site.Params.email }}</managingEditor>{{ end }}
|
||||||
|
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
|
||||||
|
{{ with .OutputFormats.Get "RSS" -}}
|
||||||
|
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||||
|
{{- end }}
|
||||||
|
{{- range $pages }}
|
||||||
|
<item>
|
||||||
|
<title>{{ .Title }}</title>
|
||||||
|
<link>{{ .Permalink }}</link>
|
||||||
|
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>{{ if site.Params.email }}
|
||||||
|
<author>{{ site.Params.email }}</author>{{ end }}
|
||||||
|
<guid>{{ .Permalink }}</guid>
|
||||||
|
<description>{{ .Content | transform.XMLEscape | safeHTML }}</description>
|
||||||
|
</item>
|
||||||
|
{{- end }}
|
||||||
|
</channel>
|
||||||
|
</rss>
|
Loading…
Reference in New Issue
Block a user