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

How to add non-section link to nav? #24

Closed
colans opened this issue Feb 28, 2019 · 10 comments
Closed

How to add non-section link to nav? #24

colans opened this issue Feb 28, 2019 · 10 comments

Comments

@colans
Copy link
Contributor

colans commented Feb 28, 2019

I'm trying to add a "Blog" link to the main nav so I can link to /blog, but I can't find any examples or documentation on how to add a link to the main nav that doesn't go to a section.

Is this possible? If so, how?

Thanks for the theme!

@colans colans changed the title How to add non-section link to nav How to add non-section link to nav? Feb 28, 2019
@SteveLane
Copy link
Owner

Hi, I haven't enabled any blog type feature, so you'd have to fiddle around with the pagination as well, unless you were just linking to a separate page?

To fiddle with menu items, you'd add a new entry to nav.html somewhere around here

This is not a huge priority for me at the moment, so I'd be saying good luck ;)

@colans
Copy link
Contributor Author

colans commented Feb 28, 2019

@SteveLane Yes, just a separate page.

What would the <a href... line look like, if you would be so kind?

@SteveLane
Copy link
Owner

I think you could just put a standard href in, e.g. <a href="link/to/my/blog/">my link text</a>

@nodoambiental
Copy link

Certainly, the icon theme is very fine. However, I can not add a different section. I search for relations in all files, and adding a new section in the nav.html does not work. @maordano

@SteveLane
Copy link
Owner

Because there's js behind the scenes sending the page to the various sections on click events, you need to override that. Try the following in the line I link to above:

<a href="myurl.html" onclick="location.href='myurl.html';">Blog</a>

@nodoambiental
Copy link

Thanks @SteveLane for the wuick response! I will try it! @maordano

@colans
Copy link
Contributor Author

colans commented Mar 5, 2019

@SteveLane Thanks! That seemed to work. Can it be added to the docs before we close this?

@SteveLane
Copy link
Owner

SteveLane commented Mar 5, 2019 via email

colans added a commit to colans/hugo-icon that referenced this issue Mar 5, 2019
SteveLane added a commit that referenced this issue Mar 5, 2019
Issue #24: Added info for adding additional pages, like a blog.
@nodoambiental
Copy link

@colans
I try this within nav.html as:
{{ if .Site.Params.blog.enable }}
Blog{{ with .Site.Params.nav.blog }}{{ . | markdownify }}{{ end }}
{{ end }}

In the config.toml I add:
[params.nav]
blog ="Blog"
and their respective:

Blog section

[params.blog]
enable = true
title = "Blog"

This show a "Blog" label correctly in the main menu of the page.
However, when I pick "Blog", the message is: "Not found: ./blog.html"

Where you put the corresponding file blog.html? What is the correct location?

Many thanks
@maordano @nodoambiental

@colans
Copy link
Contributor Author

colans commented Jun 17, 2019

@nodoambiental Please see the new instructions in the README, merged above.

@colans colans closed this as completed Jun 17, 2019
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