mirror of
https://github.com/welpo/tabi.git
synced 2026-02-15 23:57:19 +01: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
|
|
@ -1,10 +1,18 @@
|
|||
{% macro cards_pages(pages) %}
|
||||
|
||||
{%- set rel_attributes = macros_rel_attributes::rel_attributes() | trim -%}
|
||||
|
||||
{%- if config.markdown.external_links_target_blank -%}
|
||||
{%- set blank_target = "target=_blank" -%}
|
||||
{%- else -%}
|
||||
{%- set blank_target = "" -%}
|
||||
{%- endif -%}
|
||||
|
||||
<div class="cards">
|
||||
{%- for page in pages %}
|
||||
<div class="card">
|
||||
{% if page.extra.link_to %}
|
||||
<a rel="noopener noreferrer" target="_blank" href={{ page.extra.link_to }}>
|
||||
<a rel="{{ rel_attributes }}" {{ blank_target }} href={{ page.extra.link_to }}>
|
||||
{% endif %}
|
||||
{% if page.extra.local_image %}
|
||||
{% set meta = get_image_metadata(path=page.extra.local_image, allow_missing=true) %}
|
||||
|
|
@ -21,7 +29,7 @@
|
|||
<div class="card-info">
|
||||
<h1 class="card-title">
|
||||
{% if page.extra.link_to %}
|
||||
<a rel="noopener noreferrer" target="_blank" href={{ page.extra.link_to }}>{{page.title}}</a>
|
||||
<a rel="{{ rel_attributes }}" {{ blank_target }} href={{ page.extra.link_to }}>{{page.title}}</a>
|
||||
{% else %}
|
||||
<a href={{ page.permalink }}>{{page.title}}</a>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue