Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.sectionsatom.xml « layouts - github.com/reuixiy/hugo-theme-meme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e9a5a7e4514d703042dc988dd0809b4c52d27714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{{ `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }}
<!-- Reference: https://tools.ietf.org/html/rfc4287 -->
<!-- Reference: https://github.com/kaushalmodi/hugo-atom-feed/blob/master/layouts/_default/list.atom.xml -->
<!-- Reference: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml -->
{{- $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
    {{- $pages = $pages | first $limit -}}
{{- end -}}
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ .Site.LanguageCode }}">
    <title type="text">{{ .Site.Title }}</title>
    <subtitle type="html">{{ .Site.Params.siteDescription }}</subtitle>
    <updated>{{ now.Format "2006-01-02T15:04:05-07:00" }}</updated>
    <id>{{ .Permalink }}</id>
    <link rel="alternate" type="text/html" href="{{ .Permalink }}" />
    {{ with .OutputFormats.Get "SectionsAtom" -}}
        <link rel="self" type="{{ .MediaType }}" href="{{ .Permalink }}" />
    {{ end -}}
    {{ with .Site.Author.name -}}
        <author>
            <name>{{ . }}</name>
            <uri>{{ print `/` | absLangURL }}</uri>
            {{ with $.Site.Author.email }}
                <email>{{ . }}</email>
            {{ end -}}
        </author>
    {{- end }}
    {{ with .Site.Copyright -}}
        <rights>{{ . | plainify | htmlUnescape }}</rights>
    {{- end }}
    <generator uri="https://gohugo.io/" version="{{ hugo.Version }}">Hugo</generator>
    {{- range $pages }}
        {{ $page := . }}
        {{- $author := partial "utils/author.html" $page -}}
        <entry>
            <title type="text">{{ (partial "utils/title.html" (dict "$" . "title" .Title)).rawTitle }}</title>
            <link rel="alternate" type="text/html" href="{{ .Permalink }}" />
            <id>{{ .Permalink }}</id>
            <updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}</updated>
            <published>{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" }}</published>
            {{ with $author -}}
                <author>
                    {{ with .name -}}
                    <name>{{ . }}</name>
                    {{ end -}}
                    {{ with .website -}}
                    <uri>{{ . }}</uri>
                    {{ end -}}
                    {{ with .email -}}
                    <email>{{ . }}</email>
                    {{ end -}}
                </author>
            {{- end }}
            {{ with $author.copyright -}}
                <rights>{{ . | plainify | htmlUnescape }}</rights>
            {{- end }}
            {{- $summary := .Description | default (partial "utils/summary.html" $page) -}}
            <summary type="html">{{ partial "utils/make-links-absolute.html" (dict "$" . "content" $summary) | html }}</summary>
            {{ if $.Site.Params.includeContent }}
                <content type="html">{{ partial "utils/make-links-absolute.html" (dict "$" . "content" .Content) | html }}</content>
            {{ end }}
            <!-- Sections -->
            {{ if eq $.Site.Params.categoryBy "sections" }}
                {{ $.Scratch.Delete "sectionDir" }}
                {{ $sections := split (strings.TrimSuffix "/" .File.Dir) "/" }}
                {{ range $sections }}
                    {{ $section := . }}
                    {{ $.Scratch.Add "sectionDir" (printf `/%s` .) }}
                    {{ with $.Site.GetPage ($.Scratch.Get "sectionDir") }}
                        {{ if (eq .Kind "section") }}
                            <category scheme="{{ .Permalink }}" term="{{ $section }}" label="{{ $section }}" />
                        {{ end }}
                    {{ end }}
                {{ end }}
            {{ end }}
            <!-- Taxonomies -->
            {{ with $.Site.Taxonomies }}
                {{ range $taxonomy, $terms := . }}
                    {{ with $page.Param $taxonomy }}
                        {{ range $index, $term := . }}
                            {{ $url := urls.Parse ($term | urlize) }}
                            {{ $path := $url.Path }}
                            {{ with $.Site.GetPage (printf "/%s/%s" $taxonomy $path) }}
                                <category scheme="{{ .Permalink }}" term="{{ .Title | default $term }}" label="{{ .Title | default $term }}" />
                            {{ end }}
                        {{ end }}
                    {{ end }}
                {{ end }}
            {{ end }}
        </entry>
    {{ end }}
</feed>