Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check tag exists before linking #84

Closed
KyleMit opened this issue Dec 23, 2019 · 0 comments
Closed

Check tag exists before linking #84

KyleMit opened this issue Dec 23, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@KyleMit
Copy link
Member

KyleMit commented Dec 23, 2019

Make sure the tag name exists before hyperlinking to it

We currently do this for authors in layouts/post.njk:

{% set authorInfo = collections.authors[author] %}
{% if authorInfo %}
  <a href="/pages/authors/{{author | lower}}">{{ author }}</a>
{% else %}
  {{ author }}
{% endif %}

We could probably do the same for tags as we loop through before making them all hyperlinkable

{% for tag in tags | contentTags %}
  <li class="tag">
    <a href="/tags/{{tag}}" class="tag-badge">{{ tag }}</a>
  </li>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant