Skip to content

Mark the generated deploy site unlisted when a publication is - #1273

Open
oscarlevin wants to merge 1 commit into
mainfrom
deploy-unlisted-site
Open

oscarlevin wants to merge 1 commit into
mainfrom
deploy-unlisted-site

Conversation

@oscarlevin

Copy link
Copy Markdown
Member

Companion to PreTeXtBook/pretext#3339, which adds html/@unlisted to the publication file. With unlisted="yes", core puts <meta name="robots" content="noindex, nofollow, noai, noimageai"> on every page it writes.

This PR repeats that request on the landing site the CLI generates with Pelican during pretext deploy.

  • Where the setting comes from: Target.publication_unlisted() reads /publication/html/@unlisted straight from the target's publication file, as publication_csl_settings() does. No publisher-variable report is needed.
  • When it turns on: if any deployed target is unlisted, stage_deployment() sets PTX_UNLISTED = "yes". The landing page links to every target, so leaving it listed would lead crawlers straight to the unlisted one. The log names the target that caused it.
  • What gets written: the theme's base.html emits the robots meta element when PTX_UNLISTED == "yes". Article and page templates inherit it through super().
  • Override: a custom site can set <ptx-unlisted>yes|no</ptx-unlisted> in site.ptx (or PTX_UNLISTED in site.json), which wins over the publication files.
  • Other deploy setups: with no deploy targets, the CLI copies core's output, which already carries the element. A hand-made static site is left alone.
  • No robots.txt: on GitHub Pages project sites the staged folder isn't the site root.

Dependency on core

The CLI code doesn't call core for this; it only reads an attribute. But until CORE_COMMIT is bumped to a commit containing PreTeXtBook/pretext#3339:

  • core's schema rejects unlisted, so publication-file validation will flag it;
  • the publication's own pages won't carry the element.

It's best merged together with, or after, that core bump.

Tests

test_stage_unlisted_site in tests/test_project.py stages a Pelican site for unlisted="yes", "no", and an unset attribute, and checks for the meta element. It's skipped when Pelican isn't installed.

🤖 Generated with Claude Code

When the publication file of any deployed target sets html/@unlisted="yes",
the landing site Pelican generates on deploy carries the same robots meta
element core puts on the pages of an unlisted publication.  A custom site
can override this with ptx-unlisted in site.ptx.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant