summaryrefslogtreecommitdiffstats
path: root/layouts/_default/home.atom.xml
blob: b1befc0e6a5ba8a4bbfb751a0dddced22e3aad52 (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
{{ print "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>"| safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:media="http://search.yahoo.com/mrss/"
      xml:lang="{{ site.LanguageCode }}"
      xml:base="{{site.BaseURL }}">
    <title>{{ site.Title }}</title>
    {{ with site.Params.description }}<subtitle>{{ . }}</subtitle>{{ end }}
    {{ with site.Home.OutputFormats.Get "Atom" }}<link href="{{ .RelPermalink }}" rel="self" type="{{ .MediaType.Type | html }}" />{{ end }}
    {{ $logo := resources.Get (site.Params.assets.logo | default "/img/open-graph-logo.png" ) }}{{ $logo = $logo.Resize "96x96" }}<icon>{{$logo.RelPermalink}}</icon>
    <logo>{{$logo.RelPermalink}}</logo>
    {{ with site.Author.name }}<author>
        <name>{{.}}</name>
        {{ with site.Author.email }}<email>{{.}}</email>{{end}}
    </author>{{end}}
    {{ with site.Params.Copyright }}<rights type="text">{{ .}}</rights>{{end}}
    <generator uri="https://gohugo.io" version="{{ hugo.Version }}">Hugo</generator>
    {{ if not site.LastChange.IsZero }}<updated>{{ site.LastChange.UTC.Format site.Params.dateFormatFeed }}</updated>{{ end }}
    {{ $uuid := sha1 (site.BaseURL | absURL)}}<id>urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }}</id>
    {{ $feedsize := site.Params.feedSize | default 25 }}
    {{- range first $feedsize (where site.RegularPages.ByDate.Reverse "Type" "in" site.Params.mainSections) }}
    <entry>
        {{- $url := .RelPermalink }}{{ $uuid := sha1 (.Permalink | absURL)}}{{ $page := .}}
        <category term="{{ .Section}}" />
        {{ range (.GetTerms "tags") }}
        <category term="{{ .LinkTitle }}" />
        {{ end }}
        <link rel="alternate" type="type/html" href="{{ $url }}" />
        <title type="text">{{  .Title | plainify}}</title>
        <published>{{ (.PublishDate.Format site.Params.dateFormatFeed) | html }}</published>
        {{ if ne .Date .Lastmod }}<updated>{{ .Lastmod.UTC.Format site.Params.dateFormatFeed  }}</updated>{{ end }}
        <id>urn:uuid:{{ substr $uuid 0 8 }}-{{ substr $uuid 8 4 }}-5{{ substr $uuid 13 3 }}-{{ substr $uuid 16 1 }}9{{ substr $uuid 17 2 }}-{{ substr $uuid 21 12 }}</id>
        {{ if .Params.author }}
            {{- $author_type := (printf "%T" .Params.author) }}
            {{- if eq $author_type "string" }}
                <author>
                    <name>{{ .Params.author }}</name>
                </author>
            {{- else if eq $author_type "[]string" }}
                {{ range .Params.author }}
                    <author>
                        <name>{{ .Name }}</name>
                    </author>
                {{ end }}
            {{- end }}
        {{ end }}
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p>{{ replaceRE "\n" " " (.Summary | plainify | safeHTML | chomp) }}</p>
            </div>
        </summary>
    </entry>
    {{- end }}
</feed>