Link to page anchor

I have a navigation menu and a site footer on all pages.

There’s a contact anchor in the menu which i want to link to a contact section #contact in the footer at the bottom of the page.

When I link it with <a href="#contact"> it always link to /#contact. Is there a way to jump to the #contact on the current page?

Works fine here:

What does your template look like where that tag is inserted? Are you using a <base> tag in your header?

I have this in my baseOf.html file

<base href="{{ .Site.BaseURL }}">

Not sure I understand what to do with the files function

I’m generating the menu with the config settings, the contact entry being:

  • Name: "Contact us"
    Weight: -100
    indentifier: contact
    URL: “#contact

and in the template:

{{ range .Site.Menus.main }}
	<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}


If you are going to use <base>, you need to make your href an absolute path. All relative paths will have the base prepended to them.

Ok thanks, it works fine without the base tag.
like magic :slightly_smiling:

Silly me