mirror of
https://github.com/getzola/zola
synced 2025-01-09 18:38:45 +00:00
339 lines
20 KiB
HTML
339 lines
20 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en-gb">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="description" content="Everything you need to make a static site engine in one binary.">
|
|
<meta name="author" content="Vincent Prouillet">
|
|
<title>Feeds | Zola </title>
|
|
<link rel="stylesheet" href="https://www.getzola.org/site.css">
|
|
<link rel="icon" href="https://www.getzola.org/favicon.ico">
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<a class="header__logo white" href="https://www.getzola.org/">Zola</a>
|
|
<nav>
|
|
<ul>
|
|
<li><a class="white" href="https://www.getzola.org/documentation/" class="nav-link">Docs</a></li>
|
|
<li><a class="white" href="https://www.getzola.org/themes/" class="nav-link">Themes</a></li>
|
|
<li><a class="white" href="https://zola.discourse.group/" class="nav-link">Forum</a></li>
|
|
<li><a class="white" href="https://github.com/getzola/zola" class="nav-link">GitHub</a></li>
|
|
</ul>
|
|
<div class="search-container">
|
|
<input id="search" type="search" placeholder="🔎 Search the docs">
|
|
|
|
<div class="search-results">
|
|
<div class="search-results__items"></div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<div class="content content--reversed">
|
|
|
|
|
|
<div class="documentation">
|
|
<aside class="documentation__sidebar">
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Getting Started</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/installation/">Installation</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/cli-usage/">CLI usage</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/directory-structure/">Directory structure</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/getting-started/configuration/">Configuration</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Content</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/section/">Section</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/page/">Page</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/shortcodes/">Shortcodes</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/linking/">Internal links & deep linking</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/table-of-contents/">Table of Contents</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/syntax-highlighting/">Syntax Highlighting</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/taxonomies/">Taxonomies</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/search/">Search</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/sass/">Sass</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/image-processing/">Image processing</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/content/multilingual/">Multilingual sites</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Templates</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/pages-sections/">Sections and Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/pagination/">Pagination</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/taxonomies/">Taxonomies</a>
|
|
</li>
|
|
|
|
<li class="active">
|
|
<a href="https://www.getzola.org/documentation/templates/feeds/">Feeds</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/sitemap/">Sitemap</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/robots/">Robots.txt</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/404/">404 error page</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/templates/archive/">Archive</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Themes</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/installing-and-using-themes/">Installing & using themes</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/creating-a-theme/">Creating a theme</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/themes/extending-a-theme/">Customizing a theme</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<span class="documentation__sidebar__title">Deployment</span>
|
|
<ul>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/overview/">Overview</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/sourcehut/">Sourcehut Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/netlify/">Netlify</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/github-pages/">GitHub Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/gitlab-pages/">GitLab Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/codeberg-pages/">Codeberg Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/edgio/">Edgio</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/vercel/">Vercel</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/zeabur/">Zeabur</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/cloudflare-pages/">Cloudflare Pages</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/flyio/">Fly.io</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/aws-s3/">AWS S3 Bucket</a>
|
|
</li>
|
|
|
|
<li class="">
|
|
<a href="https://www.getzola.org/documentation/deployment/docker-image/">Docker image</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
</aside>
|
|
<div class="documentation__content">
|
|
|
|
<h1>Feeds</h1>
|
|
<p>If the site <code>config.toml</code> file sets <code>generate_feeds = true</code>, then Zola will
|
|
generate feed files for the site, named according to the <code>feed_filenames</code>
|
|
setting in <code>config.toml</code>, which defaults to <code>atom.xml</code>. Given the feed filename
|
|
<code>atom.xml</code>, the generated file will live at <code>base_url/atom.xml</code>, based upon the
|
|
<code>atom.xml</code> file in the <code>templates</code> directory, or the built-in Atom template.</p>
|
|
<p><code>feed_filenames</code> can be set to any value, but built-in templates are provided
|
|
for <code>atom.xml</code> (in the preferred Atom 1.0 format), and <code>rss.xml</code> (in the RSS
|
|
2.0 format). If you choose a different filename (e.g. <code>feed.xml</code>), you will
|
|
need to provide a template yourself.</p>
|
|
<p>In case you want to extend, or modify, the built-in templates, you can get a
|
|
copy from <a href="https://github.com/getzola/zola/tree/master/components/templates/src/builtins">the source code here</a>
|
|
and place it in the <code>templates/</code> directory with the appropriate name. You can
|
|
check the documentation for the specifications for Atom 1.0 and RSS 2.0 in
|
|
<a href="https://validator.w3.org/feed/docs/">W3C Feed Validation Service</a>.</p>
|
|
<p><strong>Only pages with a date will be available.</strong></p>
|
|
<p>The author in the feed is set as</p>
|
|
<ul>
|
|
<li>The first author in <code>authors</code> set in the
|
|
<a href="https://www.getzola.org/documentation/content/page/#front-matter">front matter</a></li>
|
|
<li>If that is not present it falls back to the <code>author</code> in the
|
|
<a href="https://www.getzola.org/documentation/getting-started/configuration/">Configuration</a></li>
|
|
<li>If that is also not preset it is set to <code>Unknown</code>.</li>
|
|
</ul>
|
|
<p>Note that <code>atom.xml</code> and <code>rss.xml</code> require different formats for specifying the
|
|
author. According to <a href="https://www.rfc-editor.org/rfc/rfc4287">RFC 4287</a> <code>atom.xml</code> requires the author's
|
|
name, for example <code>"John Doe"</code>. While according to the
|
|
<a href="https://www.rssboard.org/rss-specification#ltauthorgtSubelementOfLtitemgt">RSS 2.0 Specification</a> the email address is required, and the name
|
|
optionally included, for example <code>"lawyer@boyer.net"</code> or
|
|
<code>"lawyer@boyer.net (Lawyer Boyer)"</code>.</p>
|
|
<p>The feed template gets five variables:</p>
|
|
<ul>
|
|
<li><code>config</code>: the site config</li>
|
|
<li><code>feed_url</code>: the full url to that specific feed</li>
|
|
<li><code>last_updated</code>: the most recent <code>updated</code> or <code>date</code> field of any post</li>
|
|
<li><code>pages</code>: see <a href="https://www.getzola.org/documentation/templates/pages-sections/#page-variables">page variables</a>
|
|
for a detailed description of what this contains</li>
|
|
<li><code>lang</code>: the language code that applies to all of the pages in the feed,
|
|
if the site is multilingual, or <code>config.default_language</code> if it is not</li>
|
|
</ul>
|
|
<p>Feeds for taxonomy terms get two more variables, using types from the
|
|
<a href="https://www.getzola.org/documentation/templates/taxonomies/">taxonomies templates</a>:</p>
|
|
<ul>
|
|
<li><code>taxonomy</code>: of type <code>TaxonomyConfig</code></li>
|
|
<li><code>term</code>: of type <code>TaxonomyTerm</code>, but without <code>term.pages</code> (use <code>pages</code> instead)</li>
|
|
</ul>
|
|
<p>You can also enable separate feeds for each section by setting the
|
|
<code>generate_feeds</code> variable to true in the respective section's front matter.
|
|
Section feeds will use the same template as indicated in the <code>config.toml</code> file.
|
|
Section feeds, in addition to the five feed template variables, get the
|
|
<code>section</code> variable from the <a href="https://www.getzola.org/documentation/templates/pages-sections/">section
|
|
template</a>.</p>
|
|
<p>Enable feed autodiscovery allows feed readers and browsers to notify user about a RSS or Atom feed available on your web site. So it is easier for user to subscribe.
|
|
As an example this is how it looks like using <a href="https://en.wikipedia.org/wiki/Mozilla_Firefox">Firefox</a> <a href="https://addons.mozilla.org/en-US/firefox/addon/livemarks/?src=search">Livemarks</a> addon.</p>
|
|
<p><img src="https://www.getzola.org/documentation/templates/feeds/rss_feed.png" alt="RSS feed autodiscovery example." /></p>
|
|
<p>You can enable posts autodiscovery modifying your blog <code>base.html</code> template adding the following code in between the <code><head></code> tags.</p>
|
|
<pre data-lang="html" style="background-color:#383838;color:#e6e1dc;" class="language-html "><code class="language-html" data-lang="html"><span>{% block rss %}
|
|
</span><span> <</span><span style="color:#e8bf6a;">link </span><span style="color:#86c20e;">rel=</span><span>"</span><span style="color:#c1be91;">alternate</span><span>" </span><span style="color:#86c20e;">type=</span><span>"</span><span style="color:#c1be91;">application/rss+xml</span><span>" </span><span style="color:#86c20e;">title=</span><span>"</span><span style="color:#c1be91;">RSS</span><span>" </span><span style="color:#86c20e;">href=</span><span>"</span><span style="color:#c1be91;">{{ get_url(path=</span><span>"</span><span style="color:#86c20e;">rss.xml</span><span style="background-color:#b90622;color:#f8f8f0;">"</span><span style="color:#86c20e;">, trailing_slash=</span><span style="color:#a5c261;">false) </span><span style="color:#86c20e;">}}</span><span style="background-color:#b90622;color:#f8f8f0;">"</span><span>>
|
|
</span><span>{% endblock %}
|
|
</span></code></pre>
|
|
<p>You can as well use an Atom feed using <code>type="application/atom+xml"</code> and <code>path="atom.xml"</code>.</p>
|
|
<p>All pages on your site will refer to your post feed.</p>
|
|
<p>In order to enable the tag feeds as well, you can overload the <code>block rss</code> using the following code in your <code>tags/single.html</code> template.</p>
|
|
<pre data-lang="html" style="background-color:#383838;color:#e6e1dc;" class="language-html "><code class="language-html" data-lang="html"><span>{% block rss %}
|
|
</span><span> {% set rss_path = "tags/" ~ term.name ~ "/rss.xml" %}
|
|
</span><span> <</span><span style="color:#e8bf6a;">link </span><span style="color:#86c20e;">rel=</span><span>"</span><span style="color:#c1be91;">alternate</span><span>" </span><span style="color:#86c20e;">type=</span><span>"</span><span style="color:#c1be91;">application/rss+xml</span><span>" </span><span style="color:#86c20e;">title=</span><span>"</span><span style="color:#c1be91;">RSS</span><span>" </span><span style="color:#86c20e;">href=</span><span>"</span><span style="color:#c1be91;">{{/* get_url(path=rss_path, trailing_slash=false) */}}</span><span>">
|
|
</span><span>{% endblock rss %}
|
|
</span></code></pre>
|
|
<p>Each tag page will refer to it's dedicated feed.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<footer>
|
|
©2017-2024 — <a class="white" href="https://www.vincentprouillet.com">Vincent Prouillet</a> and <a class="white" href="https://github.com/getzola/zola/graphs/contributors">contributors</a>
|
|
</footer>
|
|
|
|
<script type="text/javascript" src="https://www.getzola.org/elasticlunr.min.js"></script>
|
|
<script type="text/javascript" src="https://www.getzola.org/search.js"></script>
|
|
</body>
|
|
</html>
|