Do not render title anchors as page text, use CSS content instead

This removes the '#' character from title anchors from the page body.
This was troublesome as crawlers, search engines and readers were
showing these characters as well. This character is now set as CSS
content, removing it as text from the page body.
This commit is contained in:
timvisee 2021-03-31 14:05:57 +02:00
parent f02d3d1aed
commit c394a562cf
No known key found for this signature in database
GPG Key ID: B8DB720BC383E172
2 changed files with 7 additions and 6 deletions

View File

@ -186,10 +186,15 @@ a.tag {
*/
.anchor {
margin-left: 0.1em;
transition: opacity 0.2s ease;
opacity: 0;
}
.anchor::after {
content: '#';
}
*:hover > .anchor,
.anchor:active,
.anchor:focus {

View File

@ -1,9 +1,5 @@
{% if id %}
<a class="anchor" href="#{{ id }}" aria-label="Anchor link for: {{ id }}">
#
</a>
<a class="anchor" href="#{{ id }}" aria-label="Anchor link for: {{ id }}"></a>
{% else %}
<a class="anchor" href="#" aria-label="Anchor link">
#
</a>
<a class="anchor" href="#" aria-label="Anchor link"></a>
{% endif %}