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: Create functions to inspect the union file system #12321

Open
jmooring opened this issue Mar 31, 2024 · 2 comments
Open

tpl: Create functions to inspect the union file system #12321

jmooring opened this issue Mar 31, 2024 · 2 comments
Labels
Milestone

Comments

@jmooring
Copy link
Member

Reference: https://discourse.gohugo.io/t/methods-to-traverse-the-virtual-filesystem/49058/

{{ ufs.ReadDir }}
{{ ufs.FileExists }}

Why not just modify os.ReadDir and os.FileExists?

  1. We wouldn't have to worry about breaking existing sites
  2. We're not inspecting the OS file system; we're inspecting the union file system
@bep bep removed the NeedsTriage label Mar 31, 2024
@bep bep added this to the v0.125.0 milestone Mar 31, 2024
@bep
Copy link
Member

bep commented Mar 31, 2024

{{ ufs.ReadDir }}

Maybe fs.ReadDir would mke more sense -- it's not likely we're going to invent another file system.

There are some potential suprises, though, which we need to think about before doing this. This is component dependant, but e.g. doing fs.ReadDir "content/posts" may return multiple files with the same name (with different languages). Also, the behaviour of these are very much tied to "what Hugo needs", which may change.

So we can add fs.FileExists, but we need to think about the ReadDir.

@cmahnke
Copy link

cmahnke commented Apr 1, 2024

See also #11917

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants