hugo icon indicating copy to clipboard operation
hugo copied to clipboard

Provide Shortcode param Interface at Page Level

Open HenrySkup opened this issue 6 years ago • 3 comments

So, we have .HasShortcode to tell us, at a page level, if a shortcode is used. It would be useful to be able to access the shortcodes' params at this point, too, to allow for some finer grain control .

HenrySkup avatar Dec 04 '19 10:12 HenrySkup

I don't see how. Params are per shortcode used, and you can use the same shortcode multiple times per content file.

bep avatar Dec 04 '19 10:12 bep

true, but if the content has been parsed to find the shortcodes, i would assume that it could have access at that point to each shortcode's param values? My use case is:

I wand to have multiple canvases one one page (using a {{< canvas >}} shortcode that references the JS script that codes the canvas). All canvases react and style the same way, but each may use different dependencies.

Currently there is no way to indicate at a page level these different dependencies. Of course I could have differently named shortcodes to indicate this -- this wouldn't be very DRY.

HenrySkup avatar Dec 12 '19 05:12 HenrySkup

true, but if the content has been parsed to find the shortcodes, i would assume that it could have access at that point to each shortcode's param values?

That's true, I guess. But I need to think some about this.

bep avatar Dec 12 '19 06:12 bep

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help. If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open. If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

github-actions[bot] avatar Aug 30 '25 02:08 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Nov 15 '25 02:11 github-actions[bot]