Browse Source

docs(feature/web-feed): document undocumented feature

Josh Habdas 7 months ago
parent
commit
ddc506caa1
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74
1 changed files with 65 additions and 0 deletions
  1. 65
    0
      docs/content/feature/web-feeds.md

+ 65
- 0
docs/content/feature/web-feeds.md View File

@@ -0,0 +1,65 @@
1
++++
2
+title = "Web Feeds"
3
+description = "Share RSS feeds with full-content and optional enclosures."
4
+categories = ["search"]
5
+tags = ["metadata", "robots", "SEO"]
6
+features = ["snippets", "related content", "code highlighter"]
7
++++
8
+
9
+After Dark provides RSS web feeds conforming with the {{< external "https://cyber.harvard.edu/rss/rss.html" "RSS 2.0 Specification" />}} and enhanced semantically using the following custom extensions:
10
+
11
+- {{< external "https://purl.org/rss/1.0/modules/content/" "Content Module" />}} to convey the full content of pages and posts
12
+- {{< external "https://purl.org/dc/elements/1.1/" "Dublin Core" />}} to give authorship credit on individual pages
13
+- {{< external "https://www.w3.org/2005/Atom" "Atom" />}} for improved compatibility with Atom feeds
14
+
15
+Feeds are generated automatically on a per-section basis, in addition to a consolidated site-wide feed combining content from across the site:
16
+
17
+- [/index.xml](/index.xml) site-wide feed
18
+- [/feature/index.xml](/feature/index.xml) features feed
19
+- [/module/index.xml](/module/index.xml) modules feed
20
+- [/shortcode/index.xml](/shortcode/index.xml) shortcodes feed
21
+- [/extra/index.xml](/extra/index.xml) extras feed
22
+
23
+Add multimedia attachments to pages and posts using RSS enclosures. Enclosures will output automatically to feeds when supplied. To supply an enclosure create a {{< external "https://gohugo.io/content-management/page-bundles/" "Page Bundle" />}} as described in [Post Images]({{< relref "post-images" >}}) and shown here for a blog post:
24
+
25
+```
26
+├── archetypes
27
+├── content
28
+│   └── post
29
+│       └── backup-restore-macos-mojave
30
+│           ├── assets
31
+│           │   └── macos_v10.14.3-upgrade-fail.mp4
32
+│           ├── images
33
+│           └── index.md
34
+├── layouts
35
+```
36
+
37
+Then reference the resource from front matter as shown here:
38
+
39
+```toml
40
+[[resources]]
41
+  src = "assets/macos_v10.14.3-upgrade-fail.mp4"
42
+  name = "enclosure"
43
+  title = "Software Update Malfunction: Mojave 10.14.3"
44
+  [resources.params]
45
+    length = "3705578"
46
+```
47
+
48
+{{% hackcss-alert type="info" %}}**Note:** Length is the number of bytes in the file and required by RSS 2.0 spec.{{% /hackcss-alert %}}
49
+
50
+{{% hackcss-alert type="success" %}}**Tip:** From a terminal get length using `wc -c < /path/to/file`.{{% /hackcss-alert %}}
51
+
52
+Enclosures may be output to page content by creating a custom shortcode or using a [Custom Layout]({{< relref "custom-layouts" >}}) with content like:
53
+
54
+```go-html-template
55
+{{ with .Resources.GetMatch "enclosure" }}{{ if .Params.length }}
56
+  <svg id="i-paperclip" viewBox="0 0 32 32" width="16" height="16" fill="none" stroke="var(--accent-color)" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
57
+    <path d="M10 9 L10 24 C10 28 13 30 16 30 19 30 22 28 22 24 L22 6 C22 3 20 2 18 2 16 2 14 3 14 6 L14 23 C14 24 15 25 16 25 17 25 18 24 18 23 L18 9" />
58
+  </svg>
59
+  <a href="{{ .Permalink }}" title="{{ with .Title }}{{ . }} {{ end }}[{{ .Params.length }} byte {{ .MediaType }}]">Enclosure</a>
60
+{{ end }}{{ end }}
61
+```
62
+
63
+Use the {{< external "https://validator.w3.org/feed/" "W3C Feed Validation Service" />}} to validate your feed. For help creating custom shortcodes see {{< external "https://gohugo.io/templates/shortcode-templates/#create-custom-shortcodes" "Create Your Own Shortcodes" />}} on the Hugo docs site.
64
+
65
+See {{< external "https://gohugo.io/templates/rss/" "RSS Templates" />}} in Hugo for additional information.

Loading…
Cancel
Save