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

Home lists projects instead of posts when number_of_posts < number_of_projects #93

Closed
MarcoIeni opened this issue Nov 8, 2019 · 6 comments

Comments

@MarcoIeni
Copy link

When there are less posts then projects, home page lists items belonging to portfolio instead of posts.

For example from the example site I deleted all posts except "creating a new theme" and "migrate from jekyll".
If I restart the server, portfolio items are displayed.

I don't know if it is the intended behavior, but for me it's confusing. At least it should be specified in the readme how to always show posts.

A method was expalined in issue #19, but code has changed, so it's no longer valid.
In my opinion it should be explained in the documentation.

@MarcoIeni
Copy link
Author

The problem is of course in file layouts/index.html.

For what I understood, the value of the variable site.Params.mainSections will be "portfolio" if you have more projects than posts. So this variable cannot be used.

This is my solution. I know you may not want to hardcode those values in the theme's code.

@nekr0z
Copy link

nekr0z commented Mar 18, 2020

For what I understood, the value of the variable site.Params.mainSections will be "portfolio" if you have more projects than posts.

Exactly. As expected, actually. So the proper solution is to define your own mainSections in config.toml.

@MarcoIeni
Copy link
Author

Ok, thanks.
Maybe this could be clarified in the README?
Otherwise we can close this issue.

@nekr0z
Copy link

nekr0z commented Mar 18, 2020

Maybe this could be clarified in the README?

Yeah, I agree, it's a little bit obscure. But then again, one can argue that users of the theme are expected to read hugo's documentation in addition to the theme's README.

Anyway, if I were @htr3n I would accept a pull request that documented this particular caveat in the README. Care to create one? ;)

@htr3n
Copy link
Owner

htr3n commented Mar 18, 2020

I haven't had time to follow up all recent Hugo versions, still use oldie Hugo that works fine for me so far. The changes @nekr0z mentioned, I think, are in newer Hugo, aren't they? Before, there are not so many options apart from checking the type of posts. Perhaps the developers listened to the community and created those nice features. I can incorporate the new features when I have some spare time from work, currently totally underwater. Nonetheless, any PRs are appreciated.

@MarcoIeni
Copy link
Author

I close this since it was solved in #113

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

3 participants