yannstatic/_includes/article-info.html
2024-11-08 14:10:33 +01:00

102 lines
6.0 KiB
HTML

{%- assign _author = site.data.authors[include.article.author] | default: site.author -%}
{%- if include.html != false -%}
{%- include snippets/assign.html
target=site.data.variables.default.page.show_date
source0=layout.show_date source1=include.article.show_date -%}
{%- assign _show_date = __return -%}
{%- if _show_date and include.article.modif -%}
{%- assign _show_date = true -%}
{%- else -%}
{%- assign _show_date = false -%}
{%- endif -%}
{%- include snippets/assign.html
target=site.data.variables.default.page.show_tags
source0=layout.show_tags source1=include.article.show_tags -%}
{%- assign _show_tags = __return -%}
{%- if _show_tags and include.article.tags[0] -%}
{%- assign _show_tags = true -%}
{%- else -%}
{%- assign _show_tags = false -%}
{%- endif -%}
{%- assign _show_author = include.article.author -%}
{%- include snippets/assign.html target=site.data.variables.default.page.pageview
source0=layout.pageview source1=page.pageview -%}
{%- assign _pageview = __return -%}
{%- if _pageview or include.show_pageview -%}
{%- assign _pageview = true -%}
{%- else -%}
{%- assign _pageview = false -%}
{%- endif -%}
{%- assign _paths_archive = site.paths.archive | default: site.data.variables.default.paths.archive -%}
{%- if _show_tags or _show_author or _show_date or _pageview -%}
<div class="article__info clearfix">
{%- if _show_tags -%}
<ul class="left-col menu">
{%- assign _tag_path = _paths_archive | append: '?tag=' -%}
{%- include snippets/prepend-baseurl.html path=_tag_path -%}
{%- for _tag in include.article.tags -%}
{%- assign _tag_path = __return -%}
{%- assign _tag_encode = _tag | strip | url_encode } -%}
<li>
<a class="button button--secondary button--pill button--sm" style="color:#00FFFF" href="{{ _tag_path | append: _tag_encode | replace: '//', '/' }}">{{ _tag }}</a>
</li>
{%- endfor -%}
</ul>
{%- endif -%}
{%- if _show_author or _show_date or _pageview -%}
<ul class="right-col menu">
{%- if _show_author -%}
<li><i class="fas fa-user"></i> <span>{{ _author.name }}</span></li>
{%- endif -%}
{%- if _show_date -%}
<li>
<i class="far fa-calendar-alt"></i>&nbsp;
{%- if include.article.modif != include.article.create -%}
<span title="Création" style="color:#FF00FF">{%- assign d = include.article.create | date: "%-d" -%}{%- case d -%}{%- when '1' -%}{{ d }}r{%- when '2' -%}&nbsp;{{ d }}{%- when '3' -%}&nbsp;{{ d }}{%- when '4' -%}&nbsp;{{ d }}{%- when '5' -%}&nbsp;{{ d }}{%- when '6' -%}&nbsp;{{ d }}{%- when '7' -%}&nbsp;{{ d }}{%- when '8' -%}&nbsp;{{ d }}{%- when '9' -%}&nbsp;{{ d }}{%- else -%}{{ d }}{%- endcase -%} &nbsp;{%- assign m = include.article.create | date: "%-m" -%}{%- case m -%}{%- when '1' -%}janv.{%- when '2' -%}févr.{%- when '3' -%}mars&nbsp;{%- when '4' -%}avr.&nbsp;{%- when '5' -%}mai&nbsp;&nbsp; {%- when '6' -%}juin&nbsp; {%- when '7' -%}juil.{%- when '8' -%}août&nbsp; {%- when '9' -%}sept.{%- when '10' -%}oct.&nbsp;{%- when '11' -%}nov.&nbsp;{%- when '12' -%}déc.&nbsp;{%- endcase -%}&nbsp;{{ include.article.create | date: '%Y' }}</span>
<span title="Modification" style="color:#00FF7F">{%- assign d = include.article.modif | date: "%-d" -%}{%- case d -%}{%- when '1' -%}{{ d }}r{%- when '2' -%}&nbsp;{{ d }}{%- when '3' -%}&nbsp;{{ d }}{%- when '4' -%}&nbsp;{{ d }}{%- when '5' -%}&nbsp;{{ d }}{%- when '6' -%}&nbsp;{{ d }}{%- when '7' -%}&nbsp;{{ d }}{%- when '8' -%}&nbsp;{{ d }}{%- when '9' -%}&nbsp;{{ d }}{%- else -%}{{ d }}{%- endcase -%} &nbsp;{%- assign m = include.article.modif | date: "%-m" -%}{%- case m -%}{%- when '1' -%}janv.{%- when '2' -%}févr.{%- when '3' -%}mars&nbsp;{%- when '4' -%}avr.&nbsp;{%- when '5' -%}mai&nbsp;&nbsp; {%- when '6' -%}juin&nbsp; {%- when '7' -%}juil.{%- when '8' -%}août&nbsp; {%- when '9' -%}sept.{%- when '10' -%}oct.&nbsp;{%- when '11' -%}nov.&nbsp;{%- when '12' -%}déc.&nbsp;{%- endcase -%}&nbsp;{{ include.article.modif | date: '%Y' }}</span>
{%- else -%}
<span title="Création" style="color:#FF00FF">{%- assign d = include.article.modif | date: "%-d" -%}{%- case d -%}{%- when '1' -%}{{ d }}r{%- when '2' -%}&nbsp;{{ d }}{%- when '3' -%}&nbsp;{{ d }}{%- when '4' -%}&nbsp;{{ d }}{%- when '5' -%}&nbsp;{{ d }}{%- when '6' -%}&nbsp;{{ d }}{%- when '7' -%}&nbsp;{{ d }}{%- when '8' -%}&nbsp;{{ d }}{%- when '9' -%}&nbsp;{{ d }}{%- else -%}{{ d }}{%- endcase -%} &nbsp;{%- assign m = include.article.modif | date: "%-m" -%}{%- case m -%}{%- when '1' -%}janv.{%- when '2' -%}févr.{%- when '3' -%}mars&nbsp;{%- when '4' -%}avr.&nbsp;{%- when '5' -%}mai&nbsp;&nbsp; {%- when '6' -%}juin&nbsp; {%- when '7' -%}juil.{%- when '8' -%}août&nbsp; {%- when '9' -%}sept.{%- when '10' -%}oct.&nbsp;{%- when '11' -%}nov.&nbsp;{%- when '12' -%}déc.&nbsp;{%- endcase -%}&nbsp;{{ include.article.modif | date: '%Y' }}</span>
{%- endif -%}
</li>
{%- endif -%}
{%- if _pageview -%}
{%- if site.pageview.provider -%}
{%- include snippets/get-locale-string.html key='VIEWS' -%}
{%- assign _locale_views = __return -%}
<li><i class="far fa-eye"></i> <span class="js-pageview" data-page-key="{{ include.article.key }}">0</span> {{ _locale_views }}</li>
{%- endif -%}
{%- endif -%}
</ul>
{%- endif -%}
</div>
{%- endif -%}
{%- endif -%}
{%- if include.semantic != false -%}
{%- if _author -%}
<meta itemprop="author" content="{{ _author.name }}"/>
{%- endif -%}
{%- if include.article.modif -%}
<meta itemprop="datePublished" content="{{ include.article.modif | date_to_xmlschema }}">
{%- endif -%}
{%- if include.article.tags[0] -%}
{%- assign _keywords = include.article.tags | join: ',' %}
<meta itemprop="keywords" content="{{ _keywords }}">
{%- endif -%}
{%- endif -%}