Skip to content

Add internal resolution for assets in get_url function#3065

Open
SamWilsn wants to merge 2 commits intogetzola:nextfrom
SamWilsn:feat/resolve-internal-assets
Open

Add internal resolution for assets in get_url function#3065
SamWilsn wants to merge 2 commits intogetzola:nextfrom
SamWilsn:feat/resolve-internal-assets

Conversation

@SamWilsn
Copy link
Copy Markdown
Contributor

@SamWilsn SamWilsn commented Jan 7, 2026

This is a rebase & squash of #2726 (by @ZzMzaw) on top of the latest next branch.

ZzMzaw and others added 2 commits January 7, 2026 14:33
Compute colocated path for sections

Colocated path is required for computing serialized assets and assets permalinks.
Test have been added to check colocated path format as expected by those computations.

Harmonize serialize assets for pages and sections

Fix assets serialization behavior which was relying on the output path instead of the source path like for pages.
This behavior was making assets permalinks computation fail.

Add assets permalinks for pages and sections

Compute assets permalinks for serialized assets based on associated page or section permalink.

Add assets permalinks per language to site

Assets are duplicated for every language so permalinks should be releated to it in order to be language-aware.

Add assets permalinks to `get_url`

Assets permalinks allows to resolve internally colocated assets as well as pages and sections.

Fix documentation about galery

Galery can be fixed by using internal resolution.
Adding the lang as well allows to make the target URL lang-aware even if the image is just duplicated.

Example file has been fixed as well even if it might not be used.

Fix hashmap init for assets permalink test

Check page and section entire colocated path

As discussed during PR review, it is better to check for the entire path than just the required assumptions.
Assumptions have been written as a comment.

Rework serialize_assets and get_assets_permalinks

As discussed during PR review, move option unwrapping logic outside of each function

Use iterator for get_asset_permalinks

As per PR discussion, align get_asset_permalinks with serialize_assets.

Regroup assets serialization and permalinks calls

As per PR discussion, it makes more sense to have both asset serialization and permalinks generation in the same logical unit.
Change has been made for both page and section.
@SamWilsn SamWilsn marked this pull request as draft January 7, 2026 20:12
@Keats Keats marked this pull request as ready for review January 7, 2026 20:53
@SamWilsn
Copy link
Copy Markdown
Contributor Author

SamWilsn commented Jan 7, 2026

After some quick tests, it looks like this change doesn't seem to do what it should.

  • Having a non-markdown file directly under content/ causes a panic.
  • This repository doesn't do what I would expect it to.

@SamWilsn
Copy link
Copy Markdown
Contributor Author

SamWilsn commented Jan 7, 2026

Updated with link.

I was just hoping for a quick rebase and have this work, so I haven't dug deeply into the changes here. It's entirely possible I've misunderstood the purpose of these changes.

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