All jobs

Show Last-Updated Dates on a Pelican Blog

Yes. An agent renders each post's modified date in your theme, adds a modified line only where a post's body changed after publishing, 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 starts with how the blog is configured and themed, because a last-updated date is a theme change and a metadata change together. In a blog laid out like getpelican/pelican-blog, pelicanconf.py points THEME at themes/notmyidea, a copy of Pelican's default theme kept in the repository, sets TIMEZONE, LOCALE and DEFAULT_PAGINATION, and enables the meta and toc Markdown extensions; publishconf.py adds SITEURL and DELETE_OUTPUT_DIRECTORY. The posts under content/news/ are a mix of reStructuredText and Markdown with a :date: or Date: line each. Exactly one, namespace-plugins.md, carries Modified: 2022-06-22, and no .rst post has a :modified: field.

Then it finds where the date is drawn. themes/notmyidea/templates/article_infos.html prints article.locale_date inside an <abbr class="published"> with the ISO date in its title, then the author, the category and the tag list, and both article.html and index.html include it, so the one post with a modified date shows nothing for it anywhere. base.html links the Atom and RSS feeds when FEED_ALL_ATOM or FEED_ALL_RSS is set, and the Makefile builds with make html, make publish and uploads with rsync. There are no tests and no CI workflow.

The theme change is small and goes in the one included template: after the published date, article_infos.html gets a block that renders only when article.modified is set, an <abbr class="modified"> with article.modified.isoformat() in its title and article.locale_modified as its text, so the index page and the article page show it the same way and a post with no modified date looks exactly as before. The agent also adds a <meta property="article:modified_time"> to article.html from the same field, and reads what the Atom feed does with modified by generating the site with a feed enabled and opening the feed, rather than assuming.

The metadata change is the part that needs judgement, and the agent does not invent dates. For each post it reads git log -p on the file and adds a :modified: line, or Modified: for Markdown, only where a commit after the post's date changed the body text, taking that commit's date; a commit that only touched the metadata block, the slug or a link target does not count, and the pull request lists each decision with the commit it rests on. Then it installs pelican and markdown in its sandbox, runs make html, and greps the output for class="modified" to confirm the dates render where the body changed and nowhere else.

Start it with one API call

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

{
  "agent": "claude",
  "input": "Show last-updated dates on this Pelican blog. Read pelicanconf.py, publishconf.py, the Makefile, every template under themes/notmyidea/templates and every post under content first. In article_infos.html, after the published date, render article.locale_modified inside an abbr with the ISO date in its title, only when article.modified is set, and add an article:modified_time meta tag to article.html. For each post, read its git history and add a modified line, in the format its markup uses, only where a commit after the post's date changed the body text, using that commit's date; do not add one for metadata-only or link-only commits, and list each decision with its commit in the pull request. Generate the site with a feed enabled and report what the Atom feed does with the modified date. Install pelican and markdown in the sandbox, run make html, and confirm with grep that the modified markup appears only on the posts you changed. Open a pull request whose description quotes that check.",
  "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 with two template changes, article_infos.html and article.html, and a one-line metadata addition on each post whose body changed after it was published; posts that never changed are untouched, and pelicanconf.py and the Makefile are as they were. The description lists every post that gained a modified line with the commit and date it came from, and every candidate the agent rejected as metadata-only, so the reviewer sees the reasoning per post.

The run's record keeps the make html output and the grep over output/ that shows class="modified" on exactly the changed posts and on namespace-plugins.md, which already had a date, plus what the generated Atom feed carried for an entry with a modified date.

Before merging, a reviewer reads the per-post list, decides whether a typo fix counts as a body change, and checks the rendered date format matches DEFAULT_DATE_FORMAT the way the published date does. The agent changes no date on a post it did not list.

Run it on every Monday morning

Once the theme shows the field, keeping it honest is the recurring work. A schedule trigger with cron set to Monday morning starts a run whose prompt asks the agent to read each post's git history, compare the last body-changing commit with the post's modified line, and open a pull request only when one is missing or stale, listing each change with its commit. A week with no edits opens nothing.

Each run clones the blog into its own sandbox and reads the real history, so a post edited on Thursday gets its line before the weekend's rsync. The run's record shows which posts it compared, and the pull request names the commits, so the reviewer can confirm each date in a minute.

The use case this job follows, with its automation and trigger: Hand off a long task.

Why run it on Rush?

A last-updated date added by hand goes wrong in two directions: a template that prints article.modified on every post throws on the posts that have no such field, and a bulk edit that stamps today's date on every post tells readers nothing. In a Rush sandbox the agent reads every post's git history, decides per post, renders the real site with Pelican and greps the output before it opens anything.

The build output and the per-post reasoning stay with the run, so the reviewer checks dates against commits rather than trusting a diff. Running the same job across several Pelican sites, or every Monday on one, costs no more attention than a single pull request, because each run has its own machine, its own log and its own result.

Frequently asked questions

Which posts get a modified date?

Only posts whose body text changed in a commit after the date in their metadata. The agent reads git log -p per file and lists each post it changed with the commit it used, and each one it skipped as metadata-only, so the reviewer decides the edge cases.

Will it work for both reStructuredText and Markdown posts?

Yes. A .rst post gets a :modified: field beside its :date: and a .md post gets a Modified: line beside Date:, the same two forms Pelican already reads, and namespace-plugins.md shows the Markdown form in this blog today.

Does the date show on the index page too?

Yes. index.html and article.html both include article_infos.html, so the one template change covers the featured post, the post list and the article page alike.

What happens to the feeds?

The agent generates the site with a feed enabled and reports what the Atom entry carries for a post with a modified date, rather than assuming. The pull request quotes that so the reviewer knows whether feed readers will see the update.

Will a post with no modified date look different?

No. The new block renders only when article.modified is set, so a post that was never edited shows its published date exactly as before, and the template no longer risks an error on posts without the field.

More Pelican jobs

The same job on other stacks

Keep reading