How to Link to a Specific Part of a Page

Hello. I need to link to a place in the page.
example:

## header

 Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
 
 **anchor**
 "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
 
 ## header

thanks for any suggestions

For a few cross references have a look at the Goldmark documentation about adding id attributes in Markdown headings. Then you can specify the anchor link with standard Markdown syntax link i.e. [link](#heading-id).

If you need to handle many cross references, then have a look at Links and Cross References | Hugo

unfortunately, that is only headers,

Thank you for your help

“Fake” the headers (until Goldmark implements inline anchors properly).

Method 1: Add a shortcode:

in markdown

{{< anchor "anchortitle" >}}

in shortcode

<span id="{{ .Get 0 | urlize }}" class="inlineanchor"></span>

Design via .inlineanchor.

Method 2: create a header that is hidden (bad coding, bad SEO, just for posterities sake):

in markdown

###### heading {#id .fakehiddenanchors}

in stylesheets

.fakehiddenanchors {
display: inline;
line-height:0;
... probably some more code to make it hidden enough.
}

Yes Yes!
Thank you very much!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.