website/templates/macros.html

186 lines
5.2 KiB
HTML
Raw Normal View History

2022-09-08 02:16:15 +05:30
{% macro social_link(name) %}
{% for var in config.extra.socials %}
{% if var.name == name %}
{{ var.link }}
{% endif %}
{% endfor %}
{% endmacro social_link %}
{% macro cache_bust(path) %}
{{ get_url(path=path, cachebust=true) }}"
{% endmacro cache_bust %}
{% macro social_link_icon(name, icon) %}
{% for var in config.extra.socials %}
{% if var.name == name %}
{% if var.name == "email" %}
<li class="footer__link-container">
<a class="footer__link" href="mailto:{{ var.link }}">
<img class="footer__icon" src="{{ macros::cache_bust(path=icon) }}" alt="{{ var.name }} icon ">
</a>
</li>
{% else %}
<li class="footer__link-container">
<a class="footer__link" rel="noreferrer" href="{{ var.link }}">
<img class="footer__icon" src="{{ macros::cache_bust(path=icon) }}" alt="{{ var.name }} icon ">
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endmacro social_link_icon %}
{% macro get_month(month) %}
{% if month == 1 %} January
{% elif month == 2 %} February
{% elif month == 3 %} March
{% elif month == 4 %} April
{% elif month == 5 %} May
{% elif month == 6 %} June
{% elif month == 7 %} July
{% elif month == 8 %} August
{% elif month == 9 %} September
{% elif month == 10 %} October
{% elif month == 11 %} November
{% elif month == 12 %} December
{% else %} invalid date
{% endif %}
{% endmacro get_month %}
{% macro get_meta_tags(title, description) %}
{% set title = title ~ " | LibrePages: JAMstack platform with focus on privacy and speed" %}
<link rel="stylesheet" href="{{ get_url(path='/main.css') }}" />
<link
rel="stylesheet"
media="screen and (max-width: 1300px)"
href="{{ get_url(path='/mobile.css') }}"
/>
<meta name="referrer" content="no-referrer-when-downgrade" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ title }}</title>
<meta name="referrer" content="no-referrer-when-downgrade" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="{{ description }}" />
{% if config.extra.author %}
<meta name="author" content="{{ config.extra.author }}" />
{% endif %}
<meta property="og:title" content="{{ title }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ config.base_url }}" />
<meta property="og:description" content="{{ description }}" />
<meta
property="og:site_name"
content="{{ title }}"
/>
<link
rel="apple-touch-icon"
sizes="57x57"
href="{{ get_url(path='/apple-icon-57x57.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="60x60"
href="{{ get_url(path='/apple-icon-60x60.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="72x72"
href="{{ get_url(path='/apple-icon-72x72.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="76x76"
href="{{ get_url(path='/apple-icon-76x76.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="114x114"
href="{{ get_url(path='/apple-icon-114x114.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="120x120"
href="{{ get_url(path='/apple-icon-120x120.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="144x144"
href="{{ get_url(path='/apple-icon-144x144.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="152x152"
href="{{ get_url(path='/apple-icon-152x152.png', cachebust=true) }}"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="{{ get_url(path='/apple-icon-180x180.png', cachebust=true) }}"
/>
<link
rel="icon"
type="image/png"
sizes="192x192"
href="{{ get_url(path='/android-icon-192x192.png', cachebust=true) }}"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="{{ get_url(path='/favicon-32x32.png', cachebust=true) }}"
/>
<link
rel="icon"
type="image/png"
sizes="96x96"
href="{{ get_url(path='/favicon-96x96.png', cachebust=true) }}"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="{{ get_url(path='/favicon-16x16.png', cachebust=true) }}"
/>
<link
rel="manifest"
href="{{ get_url(path='/manifest.json', cachebust=true) }}"
/>
<meta name="msapplication-TileColor" content="#ffffff" />
<meta
name="msapplication-TileImage"
content="{{ get_url(path='/ms-icon-144x144.png', cachebust=true) }}"
/>
<meta name="theme-color" content="#ffffff" />
</head>
{% endmacro get_meta_tags %}
{% macro nav_link(link, name) %}
<div class="nav__link-container">
<a class="nav__link" rel="noreferrer" href="{{ link }}">{{ name }}</a>
</div>
{% endmacro nav_link %}
{% macro nav_link_action(link, name) %}
<div class="nav__link-container--action">
<a class="nav__link" rel="noreferrer" href="{{ link }}">{{ name }}</a>
</div>
{% endmacro nav_link %}
{% macro get_author(nick) %}
{% for author in config.extra.authors %}
{% if author.nick == nick %}
<a href="{{ author.website }}" class="post__author">{{ author.name }}</a>
{% endif %}
{% endfor %}
{% endmacro get_author %}