RSS у 66 соціальних мереж: Facebook, Instagram, X, LinkedIn, Telegram та інші Блог Партнерська програма Контакти
Увійти Почати безкоштовно
Updated: 2026-11-01
Prismic RSS Feed: Query Documents, Escape XML and Auto-Post

Short answer: Prismic does not publish an RSS feed for your site, but its content API gives you everything a feed needs. Query the newest published documents of your blog type with the official client, turn each document into an item with an absolute link, the first publication date and an excerpt field, escape the text, send the RSS content type and a cache validator and test the live address. Refresh the feed when a document is published, and connect the address to an auto-poster so that every new article reaches your social channels.

Prismic is a headless content management system. Editors write documents in a visual page builder, and developers read them through an API and render them in any front end. The separation is a strength, but nothing in Prismic knows what your page addresses look like, so it cannot create a feed on its own. The feed has to be written in your own project, from the API data, and it must use the same addresses, the same unique identifiers and the same dates as your pages. This guide builds a feed handler, explains the fields that matter and ends with a test routine.

Prepare the custom type

A feed item needs a title, a permanent address, a date and a summary. In Prismic each document of a custom type, for example a blog post, carries a unique identifier called the UID, which is usually used in the page address. The title and the summary are fields you define in the type, and the dates come from the document itself.

Feed elementSource in PrismicRule
Titletitle field of the typePlain text, not the rich text structure
Link and identifieruid and the site addressAbsolute, https, never changes
Publication datefirst_publication_dateThe first time the document went live
Descriptionan excerpt fieldOne or two complete sentences
Imagean image fieldAbsolute address with a type

Use the first publication date and not the date of the last publication. An editor who fixes a typo in an old article publishes the document again, and a feed that used the last date would move the item to the top and make an auto-poster share the article twice. The causes and cures of repeated posts are covered in why a feed auto-posts the same article twice.

Query the documents

The official JavaScript client reads the master version of the repository, which contains only published documents. Ask for the blog type, newest first and a limited number, and keep the repository name in an environment variable.

// server-side module, for example lib/feed.js
import * as prismic from "@prismicio/client";

const SITE = "https://example.com";
const client = prismic.createClient(process.env.PRISMIC_REPOSITORY, { fetch });

export async function loadPosts() {
  const response = await client.getByType("blog_post", {
    pageSize: 20,
    orderings: [{ field: "document.first_publication_date", direction: "desc" }],
  });
  return response.results;
}

The package name, the helper functions and the ordering syntax can change between versions, so check them in the documentation of the version you use. If your repository is private, the client also accepts an access token, which must stay on the server. The same approach for other headless systems is covered in the Sanity feed guide, the Contentful feed guide та the Strapi feed guide.

Build the XML safely

Text from a content system can contain ampersands, angle brackets and quotation marks, and any of them can break an XML document. Escape every value before it goes into the template. Titles in Prismic are stored as structured rich text, so convert them to plain text first.

const ENT = {
  "&": "&" + "amp;",
  "<": "&" + "lt;",
  ">": "&" + "gt;",
  '"': "&" + "quot;",
  "'": "&" + "apos;",
};
const esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ENT[c]);

export function render(posts) {
  const newest = posts.length ? new Date(posts[0].first_publication_date) : new Date(0);
  const items = posts.map((p) => {
    const url = `${SITE}/blog/${p.uid}/`;
    return `<item>
      <title>${esc(prismic.asText(p.data.title))}</title>
      <link>${esc(url)}</link>
      <guid isPermaLink="true">${esc(url)}</guid>
      <pubDate>${new Date(p.first_publication_date).toUTCString()}</pubDate>
      <description>${esc(p.data.excerpt)}</description>
    </item>`;
  }).join("\n");
  return `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel>
  <title>Example Journal</title>
  <link>${SITE}</link>
  <description>News and guides from Example Journal.</description>
  <lastBuildDate>${newest.toUTCString()}</lastBuildDate>
  ${items}
</channel></rss>`;
}

Several details are deliberate. The date method of the language writes the format that the RSS specification expects. The channel date comes from the newest document and not from the clock, so that the file does not change when nothing was published. The identifier of each item is its permanent address, and the address is built from the UID and a fixed constant, so every link is absolute. If your site maps documents to addresses with a route resolver, use the same function in the feed and on the website, so that the two can never disagree.

Return the response

The route handler sets the content type, a cache lifetime and a validator, and it answers with a 304 status when the client already holds the current version.

import { createHash } from "node:crypto";

export async function GET(request) {
  const xml = render(await loadPosts());
  const etag = '"' + createHash("sha1").update(xml).digest("hex") + '"';
  const headers = {
    "Content-Type": "application/rss+xml; charset=utf-8",
    "Cache-Control": "public, max-age=300",
    ETag: etag,
  };
  if (request.headers.get("if-none-match") === etag) {
    return new Response(null, { status: 304, headers });
  }
  return new Response(xml, { status: 200, headers });
}

The validator is a hash of the finished document, so it changes exactly when the content changes. A 304 answer saves bandwidth for you and for every tool that polls the feed. The mechanism is explained in the guide to ETags and conditional requests, and the status codes in the guide to feed status codes.

Refresh the feed when editors publish

A feed cached for a few minutes is fine, but you can make it faster. Prismic can call a webhook when documents are published or unpublished. Point that webhook at a small endpoint that clears the cached copy of the feed, or rebuilds the site, and a new article appears within seconds. Keep a short cache lifetime as a safety net, because a webhook can fail without anyone noticing. Test the whole chain by publishing a draft and watching the feed, since a stale feed delays every social post.

Releases, previews and dates

Prismic lets teams group changes into releases and publish them together. Content that sits in a release is not part of the master version until the release is published, which is exactly what a feed needs: the feed shows only what readers can see. Never point a public feed at a preview or a release reference, because unpublished text would be shared on social networks before it exists on your website. If you import old articles, keep their original dates in a field of your own and map them in the feed, because a feed full of items with today’s date makes an auto-poster share the whole archive in one afternoon. For the effect of old dates see the guide to feed order and backdated posts.

Excerpts, images and encoding

Auto-posters build the best social posts from a feed that gives them a short summary and a picture. Make the excerpt a required field, so that no article reaches the feed without one, and write complete sentences instead of cutting the body automatically. If a document has an image, add it as an enclosure with an absolute address, a type and a length. Image addresses from the API are absolute, but they can carry resizing parameters, so fix the width you want in the address. Text arrives as Unicode and the response declares UTF-8, but control characters that XML forbids can still come from pasted content. See why special characters and emoji break feeds.

Several languages

Prismic repositories can hold documents in more than one locale. A feed should contain one language only, because a social channel is usually written for one audience. Pass the locale to the query, for example the language code of your main site, and build a second feed for each other language with its own address and its own channel. Never mix translations in one feed, since an auto-poster would share the same story in two languages one after the other and readers would see it as a duplicate.

Make the feed discoverable

People and tools should not have to guess where the feed is. Add a link element to the head of your site layout, with the relation set to alternate, the type set to the RSS media type and the absolute address of the feed. In most front end frameworks this goes into the metadata of the root layout. A visitor or a tool that only knows your home page can then find the feed on its own. The full explanation is in the guide to feed autodiscovery.

Test the feed

Request the route locally, then test the deployed address from outside, because a local test says nothing about the hosting platform and the certificate in front of your application.

curl -i http://localhost:3000/feed.xml
curl -i https://example.com/feed.xml
curl -i -H 'If-None-Match: "paste-the-etag-here"' https://example.com/feed.xml
  • The first two requests return 200, the RSS content type and a body that starts with an XML declaration.
  • The last request returns 304 and no body when the value matches the one the server sent.
  • Every link is absolute, uses https and opens the right page.
  • Paste the address into the W3C Feed Validation Service and fix every error.
  • Publish a document, reload the feed and confirm that the new item comes first.

A longer routine is in the feed validation guide, and a shorter one in debugging a feed with curl.

Common mistakes to avoid

  • The last publication date as the item date. Every republish moves the article to the top.
  • A preview reference in a public feed. Unpublished text leaks.
  • Rich text pasted into XML. Convert titles to plain text first.
  • Unescaped text. One ampersand in a title breaks the whole document.
  • UIDs that change. A new address makes the same article look new.
  • Only a local test. The hosting platform changes headers and caching.

How PostRSS works with a Prismic feed

PostRSS has been publishing RSS and Atom feeds to social networks since 2014. Paste the address of your feed, connect your accounts and choose how each post is built from the title, the description or the page title. PostRSS checks the feed as often as every minute and shares each new entry, with its image and link, to the channels you choose among 66 supported networks, messengers, team chats and blogs, including LinkedIn, X, Bluesky, Mastodon and Telegram. Keyword filters, UTM parameters and posting windows let you tune each channel. See the PostRSS features page and the plan limits on the pricing page. More developer guides are under the Technical Guide tag.

Пов’язане читання

The bottom line

A Prismic feed is a small handler written in your own project, and it has to get the details right: the published version of the repository, the first publication date, a required excerpt field, UIDs that match your page addresses, plain text titles, escaped text, absolute links, the correct content type and a validator that lets clients skip unchanged files. Refresh it with a webhook, test the live address with curl and a validator, then connect it to an auto-poster. After that, every article your editors publish reaches your readers and your social channels without extra work.

FAQ

Does Prismic have a built-in RSS feed?

No. Prismic delivers content through its API, so you build the feed in your own project from the documents that the API returns.

Which date should the feed use?

The first publication date. The last publication date changes whenever an editor republishes and would push old articles to the top of the feed.

How do I put a rich text title into the feed?

Convert the structured title to plain text with the helper of the client library, then escape it before it goes into the XML.

How can the feed update as soon as an editor publishes?

Set up a webhook for publish events that clears the cached feed or triggers a rebuild, and keep a short cache lifetime as a safety net.

Can PostRSS read a feed built from Prismic content?

Yes. PostRSS reads any valid RSS or Atom address that is reachable without a login. Paste the address, connect your channels and new articles are shared as soon as they appear.

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.

Більше інструментів від нашої команди

Створено Internet Solutions — командою PostRSS. Кожен продукт заощаджує ваш час по-своєму.

ШІ-чат для сайтів Talkmio Ваш сайт відповідає відвідувачам цілодобово на основі вашого контенту та їхньою мовою. Безкоштовний план · без картки ШІ-асистент Ask Mio Чат, код, дизайн, тексти й дослідження. Mio обирає найкращу модель для кожного завдання. Безкоштовний план ШІ-автопілот для блогу й соцмереж AI Blog Autopilot ШІ пише SEO-статті на 2 000–3 000 слів і публікує кожну в 60 соцмережах. Перші 3 статті безкоштовно Перевірка стану сайту Аудит ШІ сайту SEO, швидкість, SSL, безпека та налаштування пошти в одному звіті — за пріоритетом виправлень. Перший аудит безкоштовно Глибокий SEO-аудит Аудит SEO ШІ сайту Повний SEO-обхід за 7 напрямами, включно з видимістю в ШІ-пошуку, з виправленнями за впливом. Перший аудит безкоштовно RSS і товарні фіди Створювач RSS‑каналів Створюйте RSS з будь-якої вебсторінки, а також товарні фіди для Google і Meta, що оновлюються самі. Безкоштовний план Розробка сайтів і SEO Internet Solutions Сайти, інтернет-магазини та індивідуальні системи — проєктуємо, створюємо й підтримуємо самі. З 2011 року