1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-19 15:25:31 -04:00

output Atom feed

This commit is contained in:
2020-04-06 19:31:56 -04:00
parent 93f507c047
commit 51101e7865
6 changed files with 52 additions and 5 deletions

View File

@@ -80,11 +80,13 @@ disableAliases = true
weight = -70 weight = -70
[outputs] [outputs]
home = ["HTML", "RSS", "ALGOLIA", "MANIFEST", "REDIRECTS", "HEADERS"] home = ["HTML", "RSS", "ATOM", "ALGOLIA", "MANIFEST", "REDIRECTS", "HEADERS"]
section = ["HTML"] section = ["HTML"]
page = ["HTML", "AMP"] page = ["HTML", "AMP"]
[mediaTypes] [mediaTypes]
[mediaTypes."application/atom+xml"]
suffixes = ["atom"]
[mediaTypes."text/netlify"] [mediaTypes."text/netlify"]
delimiter = "" delimiter = ""
@@ -92,6 +94,9 @@ disableAliases = true
[outputFormats.RSS] [outputFormats.RSS]
mediaType = "application/rss" mediaType = "application/rss"
baseName = "feed" baseName = "feed"
[outputFormats.ATOM]
mediaType = "application/atom+xml"
baseName = "feed"
[outputFormats.AMP] [outputFormats.AMP]
mediaType = "text/html" mediaType = "text/html"
baseName = "amp" baseName = "amp"

36
layouts/index.atom Normal file
View File

@@ -0,0 +1,36 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ .Site.LanguageCode }}">
<title>{{ .Site.Title }}</title>
<id>{{ "/" | absLangURL }}</id>
<author>
<name>{{ .Site.Title }}</name>
<uri>{{ .Permalink }}</uri>
</author>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.Params.defaultImage }}
<logo>{{ . | absURL }}</logo>
{{- end }}
<updated>{{ dateFormat "2006-01-02T15:04:05Z" now.UTC | safeHTML }}</updated>
{{- with .OutputFormats.Get "ATOM" }}
{{ printf `<link rel="self" type="%s" href="%s" />` .MediaType.Type .Permalink $.Site.LanguageCode | safeHTML }}
{{- end }}
{{- range .AlternativeOutputFormats }}
{{ printf `<link rel="alternate" type="%s" href="%s" />` .MediaType.Type .Permalink $.Site.LanguageCode | safeHTML }}
{{- end }}
{{- range (where .Site.RegularPages "Section" "notes") }}
<entry>
<title>{{ .Title }}</title>
{{- with .Site.Author.name }}
<author>
<name>{{ . }}</name>
<uri>{{ $.Permalink }}</uri>
</author>
{{- end }}
<id>{{ .Permalink }}</id>
<published>{{ dateFormat "2006-01-02T15:04:05Z" .Date.UTC | safeHTML }}</published>
<content type="html">
{{ .Content | html }}
</content>
</entry>
{{- end }}
</feed>

View File

@@ -9,9 +9,13 @@
/vendor/* /vendor/*
Cache-Control: max-age=31536000, public, immutable Cache-Control: max-age=31536000, public, immutable
# Proper MIME type for Atom feed
/*.atom
Content-Type: application/atom+xml
# Recommended MIME type for PWA manifests # Recommended MIME type for PWA manifests
# https://github.com/w3c/manifest/issues/689 # https://github.com/w3c/manifest/issues/689
/manifest.json /manifest.json
Content-Type: application/manifest+json; charset=UTF-8 Content-Type: application/manifest+json
/*.webmanifest /*.webmanifest
Content-Type: application/manifest+json; charset=UTF-8 Content-Type: application/manifest+json

View File

@@ -0,0 +1,2 @@
<link rel="alternate" type="application/rss+xml" href="{{ "feed.xml" | absURL }}" title="{{ .Site.Title }} (RSS)">
<link rel="alternate" type="application/atom+xml" href="{{ "feed.atom" | absURL }}" title="{{ .Site.Title }} (Atom)">

View File

@@ -7,7 +7,7 @@
{{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}} {{ partialCached "head/favicons" (dict "pngSizes" "192 48 32 16" "icoSizes" "16 32 48") -}}
<link rel="manifest" href="{{ "site.webmanifest" | absURL }}"> <link rel="manifest" href="{{ "site.webmanifest" | absURL }}">
<link rel="canonical" href="{{ .Permalink }}"> <link rel="canonical" href="{{ .Permalink }}">
<link rel="alternate" type="application/rss+xml" href="{{ "feed.xml" | absURL }}" title="{{ .Site.Title }} (RSS)"> {{ partialCached "head/feeds" . -}}
{{ partialCached "head/webmention" . -}} {{ partialCached "head/webmention" . -}}
<link rel="author" href="{{ "humans.txt" | absURL }}"> <link rel="author" href="{{ "humans.txt" | absURL }}">
{{ if and .IsPage (eq .Type "notes") }} {{ if and .IsPage (eq .Type "notes") }}

View File

@@ -1,2 +1,2 @@
<script src="{{ "/vendor/emoji/emoji.min.js" | absURL }}"></script> <script src="{{ "vendor/emoji/emoji.min.js" | absURL }}"></script>
<script>twemoji.parse(document.body,{{ dict "base" ("/" | absURL) "folder" "vendor/emoji/svg" "ext" ".svg" | jsonify | safeJS }})</script> <script>twemoji.parse(document.body,{{ dict "base" ("/" | absURL) "folder" "vendor/emoji/svg" "ext" ".svg" | jsonify | safeJS }})</script>