Skip to content

Replace prerelease-link-subdomain with version-aware shortcode#1939

Merged
cderv merged 4 commits intomainfrom
feature/version-aware-shortcode
Mar 6, 2026
Merged

Replace prerelease-link-subdomain with version-aware shortcode#1939
cderv merged 4 commits intomainfrom
feature/version-aware-shortcode

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Mar 5, 2026

prerelease-link-subdomain is phase-aware but not version-aware. On the next RC cycle (e.g. v1.10), old blog posts about v1.9 features would incorrectly flip back to prerelease.quarto.org even though those docs already moved to quarto.org.

Fix

Replace the variable with a prerelease-docs-url shortcode extension that takes a version argument:

[PDF Accessibility](https://{{< prerelease-docs-url 1.9 >}}quarto.org/docs/output-formats/pdf-accessibility.html)

The shortcode uses two rules:

  1. On the prerelease site (prerelease-docs profile active): always return prerelease.
  2. On quarto.org: compare the arg to the version key in _quarto.yml using pandoc.types.Version. If arg <= version, docs are on quarto.org (return ""). If arg > version, docs are still only on prerelease (return prerelease.).

A new version key in _quarto.yml tracks the current stable release ('1.8' on main today). The _quarto-prerelease-docs.yml overrides it to '1.9' but the shortcode never reaches the comparison on the prerelease site (rule 1 short-circuits). The version drops the v prefix for clean comparison; the announcement banner adds it back inline.

Lifecycle of a blog post

A blog post on main announces a v1.9 feature using {{< prerelease-docs-url 1.9 >}}. The blog post itself never changes — the links flip automatically as releases happen:

On quarto.org (version comparison):

Phase version in _quarto.yml Arg Comparison Link
v1.9 in development 1.8 1.9 1.9 > 1.8 prerelease.quarto.org
v1.9 RC 1.8 1.9 1.9 > 1.8 prerelease.quarto.org
v1.9 released (version bumped) 1.9 1.9 1.9 <= 1.9 quarto.org
v1.10 in development 1.9 1.9 1.9 <= 1.9 quarto.org

On prerelease.quarto.org (prerelease-docs profile short-circuits):

All links always go to prerelease.quarto.org regardless of version, since the prerelease site hosts its own copy of the docs.

Testing

Verified each lifecycle row by rendering a test blog post and checking output links. For rows requiring a specific version value, _quarto.yml was temporarily edited.

Phase Command version Result
v1.9 dev quarto render <post> 1.8 prerelease.quarto.org
v1.9 RC quarto render <post> --profile rc 1.8 prerelease.quarto.org
v1.9 released quarto render <post> 1.9 quarto.org
v1.10 dev quarto render <post> --profile prerelease 1.9 quarto.org
Prerelease site quarto render <post> --profile "prerelease,prerelease-docs" 1.9 prerelease.quarto.org

Both quoted ("1.9") and unquoted (1.9) argument forms work correctly.

Follow-up to #1932, relates to #1934 and #1938.

@github-actions github-actions bot temporarily deployed to pull request March 5, 2026 13:56 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

📝 Preview Deployment

🔍 Full site preview: https://deploy-preview-1939.quarto.org

@github-actions github-actions bot temporarily deployed to pull request March 5, 2026 14:08 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

📝 Preview Deployment

🔍 Full site preview: https://deploy-preview-1939.quarto.org

- at: post-quarto
path: filters/include-dark.lua

version: '1.8'
Copy link
Collaborator Author

@cderv cderv Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new required addition. We would version inside _quarto.yml, with different value on main and on prerelease branches.

This way we can behave differently based on this info retrieved in Lua.

This would replace version: '1.9' in _quarto-prerelease-docs.yml - or duplicate.

I mean, if we do modify in prerelease branch version: 1.9 in _quarto.yml, it won't be possible to forgot updating when we merge prerelease in main.

Keeping it in _quarto-prerelease-docs.yml too just allows to be able to do

quarto render --profile prerelease-docs

even from main branch to activate the prerelease profile feature, if they need to be verify.

But usually --profile prerelease-docs is only ever used with prerelease branch

Hope this is clear.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand. Is it worth adding an item to our release checklist to verify/update this value?

cderv added 3 commits March 5, 2026 16:17
The `prerelease-link-subdomain` variable is phase-aware but not
version-aware — on the next RC cycle, old blog posts would incorrectly
point to prerelease.quarto.org even though those docs already moved
to quarto.org.

Add a `prerelease-docs-url` shortcode extension that compares a
version argument against the `version` key in `_quarto.yml` to decide
whether docs live on quarto.org or prerelease.quarto.org. On the
prerelease site (prerelease-docs profile), it always returns
"prerelease." regardless of version.

Follow-up to #1932, relates to #1934.
pandoc.types.Version provides element-wise comparison so older
version args (e.g. 1.8 when main is at 1.9) correctly resolve
to quarto.org instead of prerelease.quarto.org.
@cderv cderv force-pushed the feature/version-aware-shortcode branch from 5b82d94 to 9a4c7aa Compare March 5, 2026 15:40
@github-actions github-actions bot temporarily deployed to pull request March 5, 2026 15:49 Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

📝 Preview Deployment

🔍 Full site preview: https://deploy-preview-1939.quarto.org

🔄 Modified Documents

@cderv
Copy link
Collaborator Author

cderv commented Mar 5, 2026

I have also modified the blog post just merged to use this new shortcode.

@cderv cderv requested a review from cwickham March 5, 2026 15:54
Use quarto.shortcode.error_output() for clear error messages when
version metadata is missing or version arguments are malformed.
Fix missing trailing newline in _quarto-rc.yml.
@cderv cderv merged commit 63a21f0 into main Mar 6, 2026
@cderv cderv deleted the feature/version-aware-shortcode branch March 6, 2026 10:50
github-actions bot pushed a commit that referenced this pull request Mar 6, 2026
* Replace prerelease-link-subdomain with version-aware shortcode

The `prerelease-link-subdomain` variable is phase-aware but not
version-aware — on the next RC cycle, old blog posts would incorrectly
point to prerelease.quarto.org even though those docs already moved
to quarto.org.

Add a `prerelease-docs-url` shortcode extension that compares a
version argument against the `version` key in `_quarto.yml` to decide
whether docs live on quarto.org or prerelease.quarto.org. On the
prerelease site (prerelease-docs profile), it always returns
"prerelease." regardless of version.

Follow-up to #1932, relates to #1934.

* Update PDF accessibility blog post to use prerelease-docs-url shortcode

(cherry picked from commit 63a21f0)
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

Successfully created backport PR for prerelease:

cderv added a commit that referenced this pull request Mar 6, 2026
* Replace prerelease-link-subdomain with version-aware shortcode

The `prerelease-link-subdomain` variable is phase-aware but not
version-aware — on the next RC cycle, old blog posts would incorrectly
point to prerelease.quarto.org even though those docs already moved
to quarto.org.

Add a `prerelease-docs-url` shortcode extension that compares a
version argument against the `version` key in `_quarto.yml` to decide
whether docs live on quarto.org or prerelease.quarto.org. On the
prerelease site (prerelease-docs profile), it always returns
"prerelease." regardless of version.

Follow-up to #1932, relates to #1934.

* Update PDF accessibility blog post to use prerelease-docs-url shortcode

(cherry picked from commit 63a21f0)
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.

2 participants