RSS uz 66 sociālajiem tīkliem: Facebook, Instagram, X, LinkedIn, Telegram un citiem Blogs Partner programma Kontakti
Pieslēgties Sākt bez maksas
Updated: 2026-10-06
Statamic RSS Feed: Build It with Antlers and Auto-Post

Short answer: Statamic has no RSS feed switched on by default, but you can build one in minutes with a route and an Antlers template. Register Route::statamic('feed.xml', 'feed', ...) with no layout and an XML content type, loop over your blog collection with the collection tag, output permalink for absolute links and date format="r" for valid dates, and escape text with the sanitize modifier. Add the feed to your static caching invalidation rules, and an RSS auto-poster can share every new entry automatically.

Statamic is a flat-file and database-friendly CMS built on Laravel, popular with agencies and developers who want a clean control panel without giving up code-level control. Blogs, news sections, case studies and event listings are typically collections, and every one of them can become a feed. Statamic does not generate feeds automatically, which is actually an advantage: you decide exactly what goes into the XML. This guide shows a dependable way to build the feed, the settings that most often cause broken links or stale content, and how to use the feed for automatic social sharing.

What your Statamic feed should contain

Before writing the template, agree on what the feed must deliver:

  • the most recent published entries, newest first, typically 20 to 30;
  • for each entry a title, an absolute link, a short description, a publication date and a permanent guid;
  • a channel title, a link to the site and a description;
  • valid XML in UTF-8, served with an XML or RSS content type and no layout around it;
  • stable IDs, so tools never mistake an old entry for a new one.

Images and categories come later. For a refresher on what each element does, see what guid and pubDate actually do.

Step 1: register the route

Statamic lets you add routes that render a template directly. Add this to routes/web.php:

use Illuminate\Support\Facades\Route;

Route::statamic('feed.xml', 'feed', [
    'layout' => null,
    'content_type' => 'application/rss+xml',
]);

Two options do the important work. 'layout' => null stops Statamic from wrapping the XML in your site’s HTML layout, which would make the feed invalid. 'content_type' sets the response header; Statamic also accepts the short value 'xml', but the RSS type is more precise. You can confirm the result later with curl.

Step 2: the Antlers template

Create resources/views/feed.antlers.html. The example assumes a collection with the handle blog:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>{{ site:name | sanitize }}</title>
    <link>{{ site:url }}</link>
    <description>New articles from {{ site:name | sanitize }}</description>
    <atom:link href="{{ site:url }}/feed.xml" rel="self" type="application/rss+xml"/>
    {{ collection:blog limit="30" sort="date:desc" }}
    <item>
      <title>{{ title | sanitize }}</title>
      <link>{{ permalink }}</link>
      <guid isPermaLink="true">{{ permalink }}</guid>
      <pubDate>{{ date format="r" }}</pubDate>
      <description>{{ excerpt | strip_tags | sanitize }}</description>
    </item>
    {{ /collection:blog }}
  </channel>
</rss>

Notes on the template:

  • permalink, not url. In Statamic, url is the relative path of an entry and permalink is the absolute address. Feeds need absolute links, so always use permalink.
  • Escape text. The sanitize modifier converts characters such as & un < into entities. Without it, one title with an ampersand breaks the whole feed.
  • Dates. format="r" uses PHP’s RFC 2822 format, which is what RSS expects, for example Sat, 10 Oct 2026 05:15:00 +0000.
  • Excerpt field. Replace excerpt with whatever field your blueprint uses for summaries, such as meta_description, and strip HTML so the description stays plain text.

If your summaries are missing for some entries, a fallback such as {{ excerpt ?? content | strip_tags | truncate:200 }} keeps every item useful. More on summaries is in custom RSS feed excerpts.

Get the site URL right

The absolute links in the feed come from your site configuration. In Statamic, each site has a URL defined in the sites configuration, which usually refers to APP_URL in the .env file. If APP_URL still says http://localhost on production, or uses http while your site runs on https, every link in the feed is wrong, and every auto-posted link is broken.

Check three things after deployment:

  1. APP_URL in the production .env is the public https address;
  2. the site URL in Statamic’s sites configuration matches it, including any language prefix for multi-site installs;
  3. the first <link> in the live feed opens the right page in a browser.

Relative or internal links are a classic reason why shared posts lead nowhere; see relative URLs in RSS feeds.

Published, scheduled and private entries

The collection tag returns published entries by default, which is exactly what a feed needs. Two settings deserve attention:

  • Date behaviour. Dated collections can treat future entries as private or public. If you prepare posts in advance, make sure future entries are private, so they appear in the feed only when their date arrives.
  • Drafts and unlisted entries. Unpublished entries do not appear in the tag’s output. If you use a custom field to hide entries from listings, filter it in the tag, for example with a condition parameter, so hidden entries do not leak into the feed.

When scheduled entries go live, the feed must be rebuilt, which brings us to caching.

Static caching and the feed

Many Statamic sites use static caching, either the “half” strategy that stores responses in the application cache or the “full” strategy that writes HTML files to disk. The feed route is cached like any other page. That is good for performance, but if the cache is not invalidated when you publish, the feed keeps showing old content and auto-posters never see the new entry.

Add the feed to the invalidation rules in config/statamic/static_caching.php:

'invalidation' => [
    'class' => null,
    'rules' => [
        'collections' => [
            'blog' => [
                'urls' => ['/blog', '/blog/*', '/feed.xml'],
            ],
        ],
    ],
],

Now saving or publishing a blog entry clears the cached feed. For entries that are scheduled to go live later, make sure Laravel’s scheduler runs on the server, so time-based changes are picked up, and consider a short cache lifetime for the feed. A CDN in front of the site needs the same thought: very long edge caches are a frequent cause of delayed auto-posts, as explained in RSS feed caching explained.

Images, categories and full content

When the feed drives social posts, images decide how each post looks. Add an enclosure when an entry has a featured image asset:

{{ if featured_image }}
  {{ featured_image }}
  <enclosure url="{{ permalink }}" type="{{ mime_type }}" length="{{ size_bytes }}"/>
  {{ /featured_image }}
{{ /if }}

Inside the asset loop, permalink refers to the asset’s absolute URL. Adjust the field name to your blueprint. Many auto-posters also read the entry page’s og:image, so make sure your SEO setup outputs it for every entry.

Taxonomy terms become categories:

{{ tags }}<category>{{ title | sanitize }}</category>{{ /tags }}

Categories help route topics to different accounts and can be turned into hashtags. If you want full content in the feed, add the content namespace and wrap rendered HTML in content:encoded with a CDATA section, keeping description short and plain. See how to control which image gets auto-posted.

Multi-site and multilingual feeds

Statamic’s multi-site feature is often used for languages or regional versions of the same website. Each site has its own URL and its own localized entries, and each should get its own feed:

  • One feed per site. A visitor reading the German site expects German items, and a social account for one region should receive only that region’s news. Register the feed route so it works under each site’s URL, and let the collection tag return entries for the current site.
  • Correct site URLs. If the German site lives at /de/, its feed’s links must include that prefix. The permalink variable handles this when each site’s URL is configured correctly.
  • Language element. Add a <language> element with the site’s locale, such as de vai fr, so readers can label the feed.
  • Untranslated entries. Decide whether entries that exist only in the default language should appear in other sites’ feeds. Usually they should not, because a German social account posting English articles looks like a mistake.

Treat each site’s feed as a separate source in your auto-poster and connect it to the matching accounts. For strategy, see automating multi-language website content.

Feed discovery

Add an autodiscovery link to the head of your layout, so browsers, readers and tools can find the feed from any page:

<link rel="alternate" type="application/rss+xml"
      title="{{ site:name }}" href="{{ site:url }}/feed.xml">

If you have several collections, such as news and events, create a route and template per feed, or one template that takes the collection handle from route data. Give each feed a clear title so subscribers know what they are getting.

Test and validate

  • run curl -sI https://your-site/feed.xml and confirm a 200 response with the RSS content type;
  • open the feed and check that the newest entry is first and every link is absolute;
  • publish a test entry and confirm it appears after cache invalidation;
  • validate the feed once with the W3C Feed Validation Service.

The Statamic routing documentation explains the route options used above. A broader checklist is in RSS feed validation before auto-posting.

Common Statamic feed problems

SymptomCauseFix
Feed wrapped in HTMLLayout applied to the route'layout' => null
Served as text/htmlNo content type on the routeSet content_type
Links are relativeUsing url instead of permalinkOutput permalink
Links point to localhostWrong APP_URL or site URLSet the public https address
Feed breaks on one entryUnescaped ampersandAdd the sanitize modifier
New entries missingStatic cache not invalidatedPievienot /feed.xml to invalidation rules

Connect the feed to social auto-posting

Once the feed validates, sharing becomes configuration. Agencies that build Statamic sites for clients often get asked to “also post it on our socials”. Writing custom event listeners that call each network’s API means handling logins, tokens and rate limits for every client. A feed-based auto-poster does that work instead:

  • the editor publishes an entry in the control panel as usual;
  • the cache is invalidated and the feed shows the new entry;
  • the auto-poster detects it and shares it with its image and link to the connected accounts.

For agencies managing several client sites, see managing social automation across client websites.

How PostRSS works with a Statamic feed

PostRSS has been turning RSS and Atom feeds into social posts since 2014. Paste the feed address, connect your accounts and choose the post format: title, description, page title or your own text. PostRSS checks the feed as often as every minute and publishes each new entry, with its image and link, to the networks you choose among 66 supported networks, messengers, team chats and blogs. Keyword filters, UTM parameters, hashtags from categories and posting windows let you tailor each channel. See the PostRSS features page for the full list and the pricing page for plan limits. More developer guides are under the Technical Guide tag.

Related reading

The bottom line

A Statamic RSS feed is one route and one Antlers template. Disable the layout, set the content type, use permalink for absolute links, format="r" for dates and sanitize for every text value. Configure the site URL correctly, add the feed to your static caching invalidation rules and validate it once. From then on, every entry you publish can be shared on your social channels automatically.

FAQ

Does Statamic have a built-in RSS feed?

Not out of the box. You create one with a route that renders an Antlers template without a layout. It takes only a few minutes, and you control exactly which collection and fields appear in the feed.

Why are the links in my Statamic feed relative?

The template probably outputs url, which is the relative path of an entry. Use permalink instead, which returns the absolute address based on your site URL configuration.

How do I format dates for RSS in Antlers?

Use the date variable with format r, which is PHP’s RFC 2822 format. It produces dates such as Sat, 10 Oct 2026 05:15:00 +0000, which readers and validators accept.

Why does my feed not show the newest entry?

Static caching is the usual cause. Add the feed URL to the invalidation rules for the collection, so publishing an entry clears the cached feed. Also check CDN cache lifetimes.

Can Statamic entries be posted to social media automatically?

Yes. Once the feed is live and valid, an RSS auto-poster such as PostRSS can read it and share each new entry with the networks you connect, without custom code in your Statamic project.

New guides, once a month

What changed in the networks, what broke, and how to fix it before it costs you reach.

We send a confirmation e-mail first. Unsubscribe any time.

Vairāk mūsu komandas rīku

Izstrādājusi Internet Solutions — PostRSS komanda. Katrs produkts ietaupa laiku savā veidā.

PostRSS - RSS plūsmu automatizācija un auto-postēšanas rīks
Privātuma pārskats

Šī tīmekļa vietne izmanto sīkfailus, lai mēs varētu nodrošināt jums pēc iespējas labāku lietotāja pieredzi. Sīkfailu informācija tiek saglabāta jūsu pārlūka programmā un pilda tādas funkcijas kā jūsu atpazīšana, kad jūs atgriezieties mūsu vietnē, kā arī palīdz mūsu komandai saprast, kuras vietnes sadaļas jums šķiet interesantākās un noderīgākās.