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

Excessively restrictive requirements on source layout #25

Open
deadmoose opened this issue Jan 30, 2020 · 0 comments
Open

Excessively restrictive requirements on source layout #25

deadmoose opened this issue Jan 30, 2020 · 0 comments

Comments

@deadmoose
Copy link

These checks look for the rightmost location of specific directory names (content, static, etc), requiring the actual source repository have directories named that, despite the fact that the files are copied to a secondary location.

In addition, the implementation of that check requires that the directory (e.g. content) must have a slash preceding the prescribed name, so you cannot have them at the very top of the workspace.

https://github.com/deadmoose/hugo_rules_content_demo demonstrates some potential layouts:

  • top_level shows the content directory at the very top & fails: failed to get relative path: couldn't find content in content/_index.md
  • anything_else doesn't call it content, and thus fails: failed to get relative path: couldn't find content in foo/bar/_index.md
  • down_one works because the content directory is foo/content so it's internally calling relative_path('foo/content/_index.md', 'content')
  • double_content shows a situation where someone happens to name a directory within their site content. Since the rightmost occurrence of /content/ is treated as special, both foo/content/_index.md and foo/content/foo/content/_index.md try to generate the same output file & it chokes.

I've got full sympathies for how painful it is to do complex transforms from your source layout to something else, but the silent misbehavior if anyone happens to use one of the fairly common reserved words (content, static, images, layouts, data, assets, i18n) is pretty dangerous, and failing on a workspace-root version of one of those is extremely confusing when onboarding.

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

No branches or pull requests

1 participant