HugoBlox / hugo-blox-builder

🚨 GROW YOUR AUDIENCE WITH HUGOBLOX! 🚀 HugoBlox is an easy, fast no-code website builder for researchers, entrepreneurs, data scientists, and developers. Build stunning sites in minutes. 适合研究人员、企业家、数据科学家和开发者的简单快速无代码网站构建器。用拖放功能、可定制模板和内置SEO工具快速创建精美网站!
https://hugoblox.com/templates/
MIT License
8.2k stars 2.9k forks source link

Docs list of sub-sections cannot be named "docs" #1669

Closed phol closed 4 years ago

phol commented 4 years ago

Describe the bug

I wanted to create a documentation section for my blog. Therefore, I copied the courses folder from themes/acadamic/exampleSite/content. Renaming this, as is suggested in the documentation, to docscauses the following error:

ERROR 2020/04/29 01:25:03 Please define menu items named `menu: docs:` in your docs/_index.md front matter or define `[[menu.docs]]` in `config/default/menus.toml`. See https://sourcethemes.com/academic/docs/managing-content/#menus
Total in 178 ms
ERROR 2020/04/29 01:25:03 Rebuild failed:

To Reproduce

Steps to reproduce the behavior:

  1. Create a hugo blog using academic-kickstart
  2. Copy the exampleSite/content/courses folder
  3. Rename courses to docs.

Expected behavior

It should not error. I should be able to successfully rename everything to docs. The problem has to be something with calling the folder docs, because if I instead call it documentation and follow the exact same steps, it doesn't give this error.

Technical details:

gcushen commented 4 years ago

For an example of creating a folder for docs content named docs see https://github.com/sourcethemes/academic-www/tree/master/content/en/docs

phol commented 4 years ago

Yes, I also reviewed that possibility, but for my use-case, I am using folders per project and would like to have an overview of entries as is the case on the /courses page on the exampleSite . This is why I was wondering if /docs is a purposefully reserved folder name. If that's the case then this is not a bug. If that's not the case, it is.

gcushen commented 4 years ago

Refer to the Hugo docs/forums - Hugo has a feature where you can specify layout or type in the front matter of pages to use a layout or type other than the default.

phol commented 4 years ago

I made a screencast describing the issue. This is what happens when I run hugo server -D and I go back and forth between courses, documentation and docs. https://imgur.com/qhcGUfu

You can see that it errors when I rename the folder docs, but it doesn't error when renamed to anything else.

gcushen commented 4 years ago

The issue appears related to the nuances of how Hugo handles content.

It appears that in your example, Hugo is no longer recognising the page as a Hugo section of sections, but as a Hugo list. Hence, it attempts to apply the wrong layout.

An easy workaround is just to name the folder as something other than docs and change the URL in config.toml using Hugo's permalink feature - see Hugo docs.

phol commented 4 years ago

Alright, thanks for your suggestion, I will try that. If it would be useful, I can open an issue on the hugo repository?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any recent activity. The resources of the Academic 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 close soon if no further activity occurs. Thank you for your contributions.