Search code examples
htmlanchorbloggerlabelblogspot

Is it possible to add anchor html in labels on blogger / blogspot?


I know it's possible to add anchor html links in blogger posts like this:

<a href="#test">Test</a>
<a name="test">Test</a>

and this works too.

I want to apply anchor html also in labels but when I add hashtag # to label Blogger converts # in %23 in url address, so the anchor link don't work Any trick or solution?


Solution

  • I have found solution and want share with stackoverflow community In template html jump to widget label expand it and find following code:

    <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
    

    replace it with:

    <a expr:dir='data:blog.languageDirection' expr:href='&quot;/#&quot; + data:label.name'><data:label.name/></a>
    

    or for jump to a anchor in an other post:

    <a expr:dir='data:blog.languageDirection' expr:href='data:label.url + &quot;/#&quot; + data:label.name'><data:label.name/></a>
    

    source: https://productforums.google.com/d/msg/blogger/4Xc38prc4Po/shW-6X1SAAAJ

    Alternative solution: replace code:

    <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a>
    

    with following:

    <a class='tagslist__link' expr:href='data:blog.canonicalHomepageUrl path "/search/label/#" + data:label.name'><data:label.name/></a>
    

    or for jump to a anchor in an other post:

    <a class='tagslist__link' expr:href='data:blog.canonicalHomepageUrl path "/search/label/" + data:label.name + "/#" + data:label.name'><data:label.name/></a>
    

    source: https://disqus.com/home/discussion/zkreations1/operadores_path_params_y_fragment_en_blogger/?utm_source=reply&utm_medium=email&utm_content=read_more#comment-3503042930

    https://www.zkreations.com/2017/04/path-params-fragment-blogger.html#comment-3505039635

    all credits goes to the author