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

Keeping homepage URL as base URL #46

Open
keanemind opened this issue May 31, 2018 · 4 comments
Open

Keeping homepage URL as base URL #46

keanemind opened this issue May 31, 2018 · 4 comments

Comments

@keanemind
Copy link

keanemind commented May 31, 2018

With the recent changes to allow for multiple portfolios, the theme now forces the homepage to be a subfolder. For example, the homepage of the example site is no longer https://example.org. Instead, the user is redirected to https://example.org/portfolio/.

I would prefer it if the homepage did not redirect to a subfolder, since I don't like the way it looks in the address bar. I know this is a small thing, but it also has a side effect of causing Hugo to set the homepage's .Title variable (page title in the browser tab) to the pluralized folder name. For example, if the homepage's folder is "portfolio", as it is for the example site, the page title will be "Portfolios". In order to change this, I have to add an _index.md file inside the "portfolio" folder with contents

+++
title = "Creative Portfolio"
+++

to keep the homepage's page title consistent with the website name. In my humble opinion, this is not a preferable default behavior for the theme.

What do you think? Is there a way to have multiple portfolios, and yet also keep the homepage URL as the base URL?

@kishaningithub
Copy link
Owner

@keanemind As of now i don't but i will rethink about this. Suggestions are always welcome!

keanemind added a commit to keanemind/hugo-creative-portfolio-theme that referenced this issue Jun 2, 2018
@keanemind
Copy link
Author

keanemind commented Jun 2, 2018

What I did to try to address this on my own site is I changed the index.html layout back to what it was before, and then added an if statement to the portfolio.html layout where I check if the current URL is the homepage. If it isn't, then I have the block of code that's currently there: {{ range .Data.Pages }} and then the masonry box. However, if the current URL is the homepage, I instead use {{ range (where .Data.Pages "Section" "home-folder's-name-here") }} to iterate and generate the masonry boxes.

This might be a bit of a confusing explanation, so here's a link to the same changes but in a commit in my fork of the theme: keanemind@7857c5a

To be honest, I'm not that familiar with Go templates and I don't know if that's the best way to do this, but it seems to be working without causing other issues so far.

@Dapuva76
Copy link

Totally agree with keanenmind. Used this theme in the past and really liked it, but had to abandon it because loadtimes were too long. Want to use it for a different project now, but the change to the default title feels weird. Just curious, if I have folder called "story", does it expand to "storys"?

@tormodvolden
Copy link

I cannot get keanemind/hugo-creative-portfolio-theme@7857c5a to work, simply checking out his branch and using the exampleSite folder (adding a themes folder with a soft link to ../..). I have tried hugo 0.40, 0.68 and 0.73. The resulting public/index.html has an empty grid class div. Did it ever work in the exampleSite folder?

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

No branches or pull requests

4 participants