Skip to content

Add a small helper to auto generate internal links from matrix.org links#3396

Open
MTRNord wants to merge 1 commit into
mainfrom
MTRNord/internal_link_helper
Open

Add a small helper to auto generate internal links from matrix.org links#3396
MTRNord wants to merge 1 commit into
mainfrom
MTRNord/internal_link_helper

Conversation

@MTRNord
Copy link
Copy Markdown
Member

@MTRNord MTRNord commented May 4, 2026

Description

Helper which should correctly convert matrix.org absolute urls to the internal zola format on a given file if you run it from the root of the matrix.org repo.

Not a python person so this may be wrong in places? Feel free to nit?

Related issues

Role

Website & Content WG

Timeline

N/A

Signoff

See commits

Signed-off-by: MTRNord <MTRNord@users.noreply.github.com>
@MTRNord MTRNord requested a review from a team as a code owner May 4, 2026 17:44
@MTRNord MTRNord added enhancement This would be an improvement to the website. meta Something concerning the repo itself, such as technical changes, contribution guidelines, and more. labels May 4, 2026
@/ prefix, which references content from the content/ directory. It intelligently
resolves file paths by checking the actual directory structure.

Usage:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what's the content_root here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Its mostly a convenience feature for when I was testing which allowed me to have some test file in /tmp and then point at the correct content folder of matrix.org. Will update the docs to reflect that :)

from pathlib import Path


def find_file_in_content(path_segment: str, content_root: Path) -> str | None:
Copy link
Copy Markdown
Contributor

@HarHarLinks HarHarLinks May 4, 2026

Choose a reason for hiding this comment

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

this failed to find the right election centre in ee69d53

Was

### Room Directory Working Group ([website](@/foundation/working-groups/room-directory.md))
deliberate or also some bug?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No that was regex accident before this script was done. This script wasnt in full used on the last twim.

Copy link
Copy Markdown
Contributor

@weeman1337 weeman1337 left a comment

Choose a reason for hiding this comment

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

I wold suggest to include a call of zola check to the script after replacing the URLs. Otherwise, just go for it?

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

Labels

enhancement This would be an improvement to the website. meta Something concerning the repo itself, such as technical changes, contribution guidelines, and more.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants