Create a link component
This commit is contained in:
parent
955b8fc3f6
commit
a142b1ab6b
|
|
@ -4,7 +4,10 @@
|
|||
<span></span>
|
||||
<div class="links">
|
||||
{%- for link in links -%}
|
||||
<a href="{{ link.link }}" target="_blank" title="{{ link.title }}" class="{{ link.icon }}"></a>
|
||||
{% capture href %}{{ link.link }}{% endcapture %}
|
||||
{% capture classes %}{{ link.icon }}{% endcapture %}
|
||||
{% capture label %}{{ link.title }}{% endcapture %}
|
||||
{% render 'partials/components/link', showLabel: false, label: label, href: href, class: classes, target: "_blank" %}
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
9
src/_includes/partials/components/link.liquid
Normal file
9
src/_includes/partials/components/link.liquid
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<a
|
||||
href="{{ href }}"
|
||||
{% if rel %}rel="{{ rel }}"{% endif %}
|
||||
{% if class %}class="{{ class }}"{% endif %}
|
||||
{% if title %}title="{{ title }}"
|
||||
{% else %}title="{{ label }}"{% endif %}
|
||||
{% if target %}target="{{ target }}"{% endif %}
|
||||
>{% if showLabel == true or showLabel == nil %}{{ label }}{% endif %}
|
||||
</a>
|
||||
|
|
@ -1,10 +1,19 @@
|
|||
<ul class="list-inline socials-list {% if showLabel == true %}socials-list--label{% endif %}">
|
||||
{% if socials %}
|
||||
{% for social in socials %}
|
||||
<li><a href="{{ social.link }}" class="{{ social.icon }} {% if showLabel == true %}{{ position | default: "icon--left" }}{% endif %}" title="{{ social.title }}" target="_blank">{% if showLabel == true %}{{ social.title }}{% endif %}</a></li>
|
||||
<li>
|
||||
{% capture href %}{{ social.link }}{% endcapture %}
|
||||
{% capture classes %}{{ social.icon }} {% if showLabel == true %}{{ position | default: "icon--left" }}{% endif %}{% endcapture %}
|
||||
{% capture label %}{{ social.title }}{% endcapture %}
|
||||
{% render 'partials/components/link', showLabel: showLabel, label: label, href: href, class: classes, target: "_blank" %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if mail %}
|
||||
<li><a href="mailto:{{ mail }}" class="icon-mail {% if showLabel == true %}{{ position | default: "icon--left" }}{% endif %}" title="Contactez moi par mail" target="_blank">{% if showLabel == true %}Contactez moi par mail{% endif %}</a></li>
|
||||
<li>
|
||||
{% capture href %}mailto:{{ mail }}{% endcapture %}
|
||||
{% capture classes %}icon-mail {% if showLabel == true %}{{ position | default: "icon--left" }}{% endif %}{% endcapture %}
|
||||
{% render 'partials/components/link', showLabel: showLabel, label: "Contactez moi par mail", href: href, class: classes, target: "_blank" %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
<footer class="wrapper-full">
|
||||
<div>
|
||||
<ul class="list-inline">
|
||||
<li>Réalisé avec <a href='https://11ty.dev/' target='_blank' rel='nofollow'>Eleventy</a></li>
|
||||
<li>Réalisé avec {% render 'partials/components/link', label: "Eleventy", href: "https://11ty.dev/", target: "_blank", rel: "nofollow" %}</li>
|
||||
{% if site.repository and site.repository != "" %}
|
||||
<li>Source sur <a href="{{site.repository}}" target="_blank" rel="nofollow">{{site.repoSrc}}</a></li>
|
||||
{% capture href %}{{ site.repository }}{% endcapture %}
|
||||
{% capture label %}{{ site.repoSrc }}{% endcapture %}
|
||||
<li>Source sur {% render 'partials/components/link', label: label, href: href, target: "_blank", rel: "nofollow" %}</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue