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

tpl/tplimpl: Prevent overloading of embedded comment shortcode #13277

Closed
wants to merge 1 commit into from

Conversation

jmooring
Copy link
Member

@jmooring jmooring commented Jan 17, 2025

Creates a mechanism to prevent loading of user space templates that
match a list of reserved paths. The primary intent is to prevent users
from overloading specific embedded templates. For example, with the
string "shortcodes/comment" in the list of reserved paths, we do not
load any of the following from user space:

  • layouts/shortcodes/comment.html
  • layouts/shortcodes/comment.html.html
  • layouts/shortcodes/comment.en.html.html
  • layouts/shortcodes/comment.json"
  • layouts/shortcodes/comment.json.json"
  • layouts/shortcodes/comment.en.json.json"

@jmooring jmooring changed the title tpl/tplimpl: Add a cautionary note to the comments shortcode tpl/tplimpl: Prevent overloading of embedded comment shortcode Jan 18, 2025
@jmooring jmooring force-pushed the comment-warning branch 2 times, most recently from 7f2172b to 58e9a1d Compare January 18, 2025 01:32
Creates a mechanism to prevent loading of user space templates that
match a list of reserved paths. The primary intent is to prevent users
from overloading specific embedded templates. For example, with the
string "shortcodes/comment" in the list of reserved paths, we do not
load any of the following from user space:

  - layouts/shortcodes/comment.html
  - layouts/shortcodes/comment.html.html
  - layouts/shortcodes/comment.en.html.html
  - layouts/shortcodes/comment.json"
  - layouts/shortcodes/comment.json.json"
  - layouts/shortcodes/comment.en.json.json"
@bep
Copy link
Member

bep commented Jan 18, 2025

I have thought about this a little, and I understand the problem we're trying to solve, but I suspect a simpler way to go about this is to introduce a reserved namespace (e.g. h:comment) -- and then deprecate the old. I have had some ideas/use cases for a internal Hugo shortcode namespace before (cannot think of an example now, but I think they were great ideas).

We should think a little about what the namespace should look like, though.

@jmooring
Copy link
Member Author

Closing in favor of #13278.

@jmooring jmooring closed this Jan 18, 2025
@jmooring jmooring deleted the comment-warning branch January 18, 2025 15:58
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