mirror of
https://github.com/welpo/tabi.git
synced 2025-10-11 07:46:15 +02:00
✨ feat(HTML): respect external_links_…
config (#126)
This commit is contained in:
parent
9c3e5d3990
commit
b73f7f5d93
5 changed files with 66 additions and 21 deletions
19
templates/macros/rel_attributes.html
Normal file
19
templates/macros/rel_attributes.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{% macro rel_attributes() %}
|
||||
|
||||
{%- set rel_attributes = [] -%}
|
||||
{%- if config.markdown.external_links_target_blank -%}
|
||||
{%- set rel_attributes = rel_attributes | concat(with="noopener") -%}
|
||||
{%- endif -%}
|
||||
{# https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel#nofollow #}
|
||||
{# This is ignored, as it doesn't make sense to set `nofollow` on projects or social links. #}
|
||||
{# {%- if config.markdown.external_links_no_follow -%}
|
||||
{%- set rel_attributes = rel_attributes | concat(with="nofollow") -%}
|
||||
{%- endif -%} #}
|
||||
{%- if config.markdown.external_links_no_referrer -%}
|
||||
{%- set rel_attributes = rel_attributes | concat(with="noreferrer") -%}
|
||||
{%- endif -%}
|
||||
|
||||
{# Return the array of rel attributes joined by a space #}
|
||||
{{- rel_attributes | join(sep=" ") -}}
|
||||
|
||||
{% endmacro external_links %}
|
Loading…
Add table
Add a link
Reference in a new issue