All jobs

Add an RSS Feed to a Wagtail Blog

Yes. An agent adds RSS and Atom feeds to your Wagtail blog index as routable sub-URLs, links them from the templates, tests them and opens a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads the blog app before it writes the feed. In a Wagtail site like wagtail/bakerydemo, requirements/base.txt pins Django>=6.0,<6.1 and wagtail>=8.0,<8.1, .python-version is 3.12, and bakerydemo/settings/base.py already lists wagtail.contrib.routable_page and django.contrib.sitemaps in INSTALLED_APPS. bakerydemo/blog/models.py defines BlogPage with introduction, image, a body StreamField of BaseStreamBlock, subtitle, tags through BlogPageTag, a date_published DateField, an authors() method that returns the live related Person objects, and a get_tags property. BlogIndexPage mixes in RoutablePageMixin, lists BlogPage.objects.descendant_of(self).live().order_by("-date_published") in get_context, exposes get_posts(tag=None), and serves tags/ and tags/<slug>/ through @route as tag_archive, rendering blog/blog_index_page.html. bakerydemo/urls.py serves sitemap.xml from wagtail.contrib.sitemaps, search/, two API roots, and wagtail_urls last. There is no feed anywhere in the project.

The feed goes on the index page, so every blog index on the site gets its own. The agent adds bakerydemo/blog/feeds.py with a BlogFeed built on django.contrib.syndication.views.Feed, which takes the BlogIndexPage as its object, uses the page's title and introduction for the channel, returns get_posts() ordered by -date_published and capped at a fixed count for items, and maps item_title, item_description from introduction, item_link from the page's url, item_pubdate from date_published made timezone-aware, item_author_name from the first of authors(), and item_categories from the tags. An AtomFeed subclass sets feed_type = Atom1Feed. BlogIndexPage gains @route(r"^feed/$", name="feed") and @route(r"^feed/atom/$", name="feed_atom") that call the feed with the request and the page, so the URLs are /blog/feed/ and /blog/feed/atom/ under whatever slug the index has, and a tag feed at tags/<slug>/feed/ reuses get_posts(tag=tag).

Templates get the discovery links. bakerydemo/templates/blog/blog_index_page.html and blog_page.html extend base.html, so the agent adds a block in the head with <link rel="alternate" type="application/rss+xml"> and the Atom variant pointing at the index's routable URL through {% routablepageurl %}, plus a visible link next to the tag filters. The feed's absolute item links use request through get_full_url, so they carry the site's hostname rather than a relative path.

The test follows bakerydemo/base/tests/test_home_page.py, which uses WagtailPageTestCase, builds the tree in setUpTestData from Page.get_first_root_node() with a Site on testserver, and asserts status, template and content. A new bakerydemo/blog/tests.py creates a BlogIndexPage with two BlogPage children, one live and one draft, fetches /feed/ under the index, parses the XML, and checks the live post is there with its title, link and date and the draft is not. It then runs what .github/workflows/ci.yml runs: make lint-server, which is ruff format --check, ruff check, curlylint --parse-only bakerydemo and djhtml --check over the templates, then ./manage.py check, ./manage.py makemigrations --check --noinput and ./manage.py test with DJANGO_SETTINGS_MODULE=bakerydemo.settings.test, using uv as the workflow does.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "A Linear issue labelled agent says: \"Add an RSS feed for the blog, with an Atom version, discoverable from the blog pages.\" Do the work in this repository. Read requirements/base.txt, bakerydemo/settings/base.py, bakerydemo/settings/test.py, bakerydemo/urls.py, bakerydemo/blog/models.py, bakerydemo/templates/blog/blog_index_page.html, bakerydemo/templates/blog/blog_page.html, bakerydemo/templates/base.html, bakerydemo/base/tests/test_home_page.py, Makefile and .github/workflows/ci.yml first. Add bakerydemo/blog/feeds.py with a Feed subclass for a BlogIndexPage that lists its live posts by date_published with title, introduction, absolute link, timezone-aware pubdate, author and tags, plus an Atom1Feed variant. Serve them from BlogIndexPage with routable routes at feed/ and feed/atom/, and a per-tag feed under tags/<slug>/feed/. Add alternate link tags in the blog templates and a visible feed link on the index. Write a test in bakerydemo/blog/tests.py in the WagtailPageTestCase style that checks a live post appears and a draft does not. Run make lint-server, ./manage.py check, ./manage.py makemigrations --check and ./manage.py test with the test settings, and open a pull request that lists the feed URLs.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

What comes back is a pull request that adds bakerydemo/blog/feeds.py and bakerydemo/blog/tests.py, extends BlogIndexPage in bakerydemo/blog/models.py with the feed routes, and touches the three templates for the discovery links. No migration is needed, because no field changes, and the description says so beside the makemigrations --check output. It lists the feed URLs relative to the index page and quotes the test and lint summaries.

The transcript holds the uv install, the ruff, curlylint and djhtml checks, manage.py check, and the test run with the feed test's assertions, so a reviewer sees the feed parsed and checked rather than described. The repository's CI runs the same lint-server and test-server jobs on the pull request.

Before merging, a reviewer checks that items use get_full_url so links carry the site hostname, that date_published being blank on a post does not raise, that drafts and unpublished pages never appear, that the tag feed answers a redirect or an empty feed for an unknown tag the way tag_archive does, and that the templates still pass djhtml. A follow-up message to the same session adds the body's first StreamField block as the item content, and the sandbox still has the environment installed.

Run it on every Linear issue labelled agent

In the Project that holds the site, add an automation with this prompt and a linear trigger on linear.issue.labeled filtered to the agent label. Each labelled content issue starts its own run in its own sandbox and ends in its own pull request; the issue text follows the prompt as data, and the trigger fills in no placeholder.

A handler on your own server does the same without the automation: it receives Linear's webhook, puts the issue text into input, and sends POST /o/{org}/sessions with the repository in resources and a request_id that is a UUID v5 of the issue id, so a redelivered webhook returns the run already started.

The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.

Why run it on Rush?

A feed is checked by running the site, fetching the XML and reading it, then running the Django suite and three linters that each want their own tool installed. In a Rush sandbox the agent has Python 3.12 and uv, installs requirements/development.txt, runs the server and the suite itself, and keeps every command and the XML it fetched in the record.

Editorial requests like a feed wait because they are small and the site's lint and test setup is long. Labelling the issue hands it to a sandbox that owns that setup, and the pull request arrives with the checks already run. Several Wagtail sites can get the same feed at once, each in its own sandbox, each with its own pull request.

Frequently asked questions

Why put the feed on the page instead of in urls.py?

BlogIndexPage already uses RoutablePageMixin for its tag archive, so a feed/ route sits beside it and every blog index on the site, in any language or section, gets its own feed at its own URL. A single entry in bakerydemo/urls.py would have to pick one index.

Does it need a migration?

No. Routes and feed classes are code, not fields, so ./manage.py makemigrations --check passes unchanged. The agent runs it as CI does and quotes the result.

What goes in each item?

The title, the introduction as the description, the absolute page URL, date_published as the publication date, the first author from authors(), and the tags as categories. The StreamField body is left out by default because its blocks render to HTML through templates; ask for it in the prompt and the agent renders the first text block into the item content.

Will drafts or scheduled posts leak into the feed?

No. The feed reads get_posts(), which filters on live(), and the test creates a draft child to prove it is absent. A post scheduled with Wagtail's go-live date is not live until it is published.

More Wagtail jobs

The same job on other stacks

Keep reading