[Support request] adding # hashtag issue

Home Forums Support [Support request] adding # hashtag issue

Home Forums Support adding # hashtag issue

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2319782
    Fraser

    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.

    #2319814
    David
    Staff
    Customer Support

    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.

    #2319829
    Fraser

    thanks, sorry, completely forgot how to add internal anchor text links !

    #2319856
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.