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

Custom page selection #46

Closed
eine opened this issue Jan 8, 2020 · 4 comments
Closed

Custom page selection #46

eine opened this issue Jan 8, 2020 · 4 comments

Comments

@eine
Copy link
Contributor

eine commented Jan 8, 2020

In the README it's read that:

If you want a different page selection, please provide your own layouts/index.html template.

However, there is no layouts/index.html file in the theme. The logic seems to be defined in layouts/_default/baseof.html. Is the comment correct or is it outdated?

@bep
Copy link
Owner

bep commented Jan 8, 2020

No, that statement is still correct.

@eine eine closed this as completed Jan 8, 2020
@eine
Copy link
Contributor Author

eine commented Jan 8, 2020

Thanks. It seems that I need to revisit hugo's templating/layout engine...

@bep
Copy link
Owner

bep commented Jan 8, 2020

A little longer explanation:

  • A template in the project with the same name in the project will always win over the theme version
  • layouts/index.html will win over layouts/_default/list.html for the home page.

So, creating either layouts/index.html or layouts/_default/list.html in your project with your custom logic will work.

@eine
Copy link
Contributor Author

eine commented Jan 8, 2020

Thanks! The point is that I used hugo quite some time ago, when baseof didn't exist (I believe), sections where limited to a single level IIRC, etc. Later, I saw that it was all reworked to support more complex and nested site layouts (which was cool to have). Now, this specific theme seems to use some of the latest features: most of the logic is defined in functions (https://github.com/bep/docuapi/tree/master/layouts/partials/funcs), which I had not used; the theme itself is a go module/package that imports other go modules, which feels awkward; and, overall, it is a single page site. So, it is just much content to digest. I need to take it slowly...

FTR, I am not documenting an API, but a project composed of a CLI tool (golang) and a GitHub Action (Typescript): https://eine.github.io/issue-runner/#introduction. I took this theme because I think it is probably the best available hugo theme for docs with lots of quotes and code examples. However, I am aware that it is currently very optimized to be a single page. It will need some work to generate sections.

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

2 participants