Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create default link and image render hooks #11945

Merged
merged 1 commit into from
Jan 30, 2024
Merged

Conversation

bep
Copy link
Member

@bep bep commented Jan 30, 2024

Fixes #11933

@bep bep force-pushed the feat/defaulthooks-11933 branch from ecd0ff5 to e164cbf Compare January 30, 2024 15:56
@jmooring
Copy link
Member

To avoid HTML5 validation "info" messages, we would need to remove the slash before the closing >.

image

@bep
Copy link
Member Author

bep commented Jan 30, 2024

To avoid HTML5 validation "info" messages, we would need to remove the slash before the closing >.

That was inserted by the Prettier formatter ... But I'll fix it.

@bep bep force-pushed the feat/defaulthooks-11933 branch 3 times, most recently from fb1fcaf to dadd265 Compare January 30, 2024 17:33
@bep bep requested a review from jmooring January 30, 2024 18:09
@bep
Copy link
Member Author

bep commented Jan 30, 2024

@jmooring this should work;

  • The templates are almost identical to your proposed versions, I just dropped the "trim trailing slash" variant in GetPage and added that trim to the GetPage implementation.

@jmooring
Copy link
Member

I just dropped the "trim trailing slash" variant in GetPage and added that trim to the GetPage implementation.

Thanks. That's great.

@bep bep merged commit 5b7cb25 into master Jan 30, 2024
8 checks passed
jmooring added a commit to jmooring/hugo-testing that referenced this pull request Jan 30, 2024
These are no longer necessary due to the built-in link and image render
hooks that are automatically enabled when:

- Site is multilingual, and
- Site is single-host, and
- markup.goldmark.duplicateResourceFiles = false

See:

- <gohugoio/hugo#11933>
- <gohugoio/hugo#11945>
@jmooring
Copy link
Member

For the record, I am quite pleased that we can now do this for every site, as needed:

[markup.goldmark.renderhooks.image]
enableDefault = true

[markup.goldmark.renderhooks.link]
enableDefault = true

For those serving sites from a subdirectory (e.g., most GitHub Pages sites) this will be a big help. And if they have images in static, just add:

[[module.mounts]]
source = 'assets'
target = 'assets'

[[module.mounts]]
source = 'static'
target = 'assets'

Thanks!

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.

Create default link and image render hooks
2 participants