You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
3.5 KiB

4 years ago
  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. [[copyright]]
  8. owner = "Josh Habdas"
  9. date = "2019"
  10. license = "agpl-3.0-or-later"
  11. +++
  12. 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:
  13. - {{< external "https://purl.org/rss/1.0/modules/content/" "Content Module" />}} to convey the full content of pages and posts
  14. - {{< external "https://purl.org/dc/elements/1.1/" "Dublin Core" />}} to give authorship credit on individual pages
  15. - {{< external "https://www.w3.org/2005/Atom" "Atom" />}} for improved compatibility with Atom feeds
  16. Feeds are generated automatically on a per-section basis, in addition to a consolidated site-wide feed combining content from across the site:
  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. 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:
  23. ```
  24. ├── archetypes
  25. ├── content
  26. │ └── post
  27. │ └── backup-restore-macos-mojave
  28. │ ├── assets
  29. │ │ └── macos_v10.14.3-upgrade-fail.mp4
  30. │ ├── images
  31. │ └── index.md
  32. ├── layouts
  33. ```
  34. Then reference the resource from front matter as shown here:
  35. ```toml
  36. [[resources]]
  37. src = "assets/macos_v10.14.3-upgrade-fail.mp4"
  38. name = "enclosure"
  39. title = "Software Update Malfunction: Mojave 10.14.3"
  40. [resources.params]
  41. length = "3705578"
  42. ```
  43. {{% hackcss-alert type="info" %}}**Note:** Length is the number of bytes in the file and required by RSS 2.0 spec.{{% /hackcss-alert %}}
  44. {{% hackcss-alert type="success" %}}**Tip:** From a terminal get length using `wc -c < /path/to/file`.{{% /hackcss-alert %}}
  45. Enclosures may be output to page content by creating a custom shortcode or using a [Custom Layout]({{< relref "custom-layouts" >}}) with content like:
  46. ```go-html-template
  47. {{ with .Resources.GetMatch "enclosure" }}{{ if .Params.length }}
  48. <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">
  49. <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" />
  50. </svg>
  51. <a href="{{ .Permalink }}" title="{{ with .Title }}{{ . }} {{ end }}[{{ .Params.length }} byte {{ .MediaType }}]">Enclosure</a>
  52. {{ end }}{{ end }}
  53. ```
  54. 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.
  55. See {{< external "https://gohugo.io/templates/rss/" "RSS Templates" />}} in Hugo for additional information.