Archived topic
adding # hashtag issue
3 replies · Started by Fraser on August 22, 2022
I'm on a Mac - Catalina Version 10.15.7 and cannot add a hashtag # sign to Generate Press - no issues adding hashtag # sign with any other programme.
https://www.screencast.com/t/NTEfIx0Zn
Hi there,
the HTML Anchor field is a core WordPress field, you will find it for ( almost ) every Block you add to a page.
Whatever value you add in that field will get output to the ID attribute of the blocks HTML.
eg.
<div id="my-html-anchor-field-value" class="gb-container ....">
And the ID attribute CANNOT contain a # - its invalid HTML.
There are a few reasons for this, but the main on is because the # is used as an general identifier when you for example:
a) reference the ID in a href attribute eg.
<a href="#my-html-anchor-field-value">My anchor link</a>
b) use it it in a CSS selector hook eg.
#my-html-anchor-field-value {
color: #f00;
}
c) or in any querySelector in Javascript for example.
So don't add the # to that field.
You add the # when you want to reference the HTML element with that ID.
thanks, sorry, completely forgot how to add internal anchor text links !
You're welcome