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 item "Second" to page-scroll? #15

Open
orschiro opened this issue Sep 18, 2016 · 5 comments
Open

How to add item "Second" to page-scroll? #15

orschiro opened this issue Sep 18, 2016 · 5 comments

Comments

@orschiro
Copy link

orschiro commented Sep 18, 2016

Dear @crakjie,

Is there any way the theme supports to do the following:

Add a new element Second after Services that upon click scrolls down to the respective section?

Thankfully,

-Robert

selection_199

@orschiro
Copy link
Author

Dear @crakjie,

Might you be able to give me a quick hint?

Thankfully,

-Robert

@crakjie
Copy link
Owner

crakjie commented Sep 26, 2016

I think you could have a tab by post if you want.
Just iterate on post and fetch there title when building the head of the page.

@orschiro
Copy link
Author

Thanks for your really helpful guidance!

I started experimenting with the following code in header.html:

{{ range .Data.Pages }}
  <li>
    <a class="page-scroll" href="#{{ .Title }}">{{ .Title }}</a>
  </li>
{{ end }}

Seems to go into the right direction. 😄

-Robert

@crakjie
Copy link
Owner

crakjie commented Sep 26, 2016

It's look good but be careful if your title contain spaces.
if you first title is "My title" and the second "My links"
you will have #My twice.
There is advanced way to make link with gohugo. But I don't remember how.

@orschiro
Copy link
Author

Thanks for the caveat! I will see how far I get. :-)

-Robert

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