mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2026-05-03 07:04:47 +00:00
Templated RSS feature to include special postroll rules
This commit is contained in:
parent
6f8ae91e56
commit
47c3dcfc5d
3 changed files with 18 additions and 63 deletions
|
|
@ -29,18 +29,12 @@
|
|||
{{ 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>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Params.email }}<author>{{.}}{{ with $.Site.Params.Author }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
{{ printf `<description><![CDATA[%s]]></description>` .Summary | safeHTML }}
|
||||
{{ printf `<content:encoded><![CDATA[%s]]></content:encoded>` .Content | safeHTML }}
|
||||
{{ range .Param "tags" }}<category>{{ . }}</category>
|
||||
{{ end }}
|
||||
</item>
|
||||
{{ end }}
|
||||
{{ range $pages }}
|
||||
{{ $itemPartial := printf "rss-item/%s.xml" .Type }}
|
||||
{{- if not (templates.Exists (printf "partials/%s" $itemPartial)) -}}
|
||||
{{- $itemPartial = "rss-item/default.xml" -}}
|
||||
{{- end -}}
|
||||
{{ partial $itemPartial . }}
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
{{ define "main"}}
|
||||
{{ .Scratch.Set "customTitleHeaderSet" true }}
|
||||
{{ .Scratch.Set "customTitleHeader" "Blog" }}
|
||||
{{ .Scratch.Set "customTitleHeaderLink" "/blog/" }}
|
||||
{{ partial "header.html" . }}
|
||||
<main>
|
||||
<article class="h-entry">
|
||||
<h1 class='title p-name'>{{ .Title }}</h1>
|
||||
<a style="display: none" class="u-url" href="{{ .Permalink }}"></a>
|
||||
<div style="display: none;" rel="author" class="h-card p-author">
|
||||
{{ $profile_image := resources.Get (printf "img/%s" .Site.Params.avatar) }}
|
||||
{{ $profile_width := 75 }}
|
||||
{{ $profile_image := $profile_image.Resize (printf "%dx webp q75" $profile_width) }}
|
||||
<img class="u-photo" width="{{ $profile_width }}" height="{{ $profile_width }}" src="{{ $profile_image.Permalink }}"/>
|
||||
<span > {{ .Site.Params.Author }}</span>
|
||||
</div>
|
||||
{{ .Scratch.Set "beforeDateString" "Published on "}}
|
||||
{{ partial "date.html" . }}
|
||||
{{ partial "reading_time.html" . }}
|
||||
{{ partial "tags/page.html" . }}
|
||||
<!-- content -->
|
||||
<div class="e-content">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</article>
|
||||
<div style="margin-bottom: 2rem; display: flex; justify-content: center; flex-wrap: wrap; gap: 20px;">
|
||||
<a href='mailto:{{ .Site.Params.email }}?subject=Re: "{{ .Title }}"' class="reply-button">Reply via Email</a>
|
||||
<a href="/support" class="reply-button" style="margin-left:2rem;"><i class="fas fa-coffee" style="margin-right: 0.5rem;"></i>Buy me a Coffee</a>
|
||||
</div>
|
||||
|
||||
{{ partial "sharepost.html" . }}
|
||||
</main>
|
||||
<!-- Metadata -->
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "NewsArticle",
|
||||
"headline": "{{ .Title }}",
|
||||
"image": [],
|
||||
"datePublished": "{{ .Date.Format "2006-01-02" }}",
|
||||
"author": [{
|
||||
"@type": "Person",
|
||||
"name": "{{ .Site.Params.Author }}",
|
||||
"url": "{{ .Site.BaseURL }}",
|
||||
"email": "mailto://{{ .Site.Params.email }}",
|
||||
"image": "{{ .Site.BaseURL }}img/{{ .Site.Params.avatar }}"
|
||||
}]
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
11
layouts/partials/rss-item/default.xml
Normal file
11
layouts/partials/rss-item/default.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Params.email }}<author>{{.}}{{ with $.Site.Params.Author }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
{{ printf `<description><![CDATA[%s]]></description>` .Summary | safeHTML }}
|
||||
{{ printf `<content:encoded><![CDATA[%s]]></content:encoded>` .Content | safeHTML }}
|
||||
{{ range .Param "tags" }}<category>{{ . }}</category>
|
||||
{{ end }}
|
||||
</item>
|
||||
Loading…
Add table
Add a link
Reference in a new issue