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

Default path resolution for partials when a directory is passed #11117

Open
UtkarshVerma opened this issue Jun 16, 2023 · 1 comment
Open

Default path resolution for partials when a directory is passed #11117

UtkarshVerma opened this issue Jun 16, 2023 · 1 comment

Comments

@UtkarshVerma
Copy link

Hugo's partial resolution does not currently support directories as paths. Having them would be convenient as they would allow more modular and self contained Hugo modules. For example, I'm currently developing something like this:

layouts/partials/
-> identicon/
----> color.html
----> main.html
----> path.html

To use this module, I have to explicitly state that I want to include the main partial:

{{ partial "identicon/main" . }}

However, it makes more sense to call {{ partial "identicon" }} and have it resolve to identicon/main.html or identicon/index.html by default.

To attain this behaviour with the current release, I have to create another file partials/identicon.html which simply calls partials/identicon/main.

This leads to an extra file in the partial tree, which is unpreferable in terms of organization:

layouts/partials/
-> identicon/
----> color.html
----> main.html
----> path.html

-> identicon.html

I propose a path resolving mechanism be implemented in Hugo which resolves directory includes either main.html or index.html. It would make the file structure more organized and self contained.

Copy link

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 github-actions bot added the Stale label Jun 16, 2024
@bep bep added Keep and removed NeedsTriage labels Jun 16, 2024
@bep bep added this to the v0.128.0 milestone Jun 16, 2024
@github-actions github-actions bot removed the Stale label Jun 17, 2024
@bep bep modified the milestones: v0.128.0, v0.129.0 Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants