Add workaround for icons backwards compatibility

Now old pelicanconf.py should be rendered correctly with new Font Awesome:
- Some special cases are hardcoded. For now those are 'rss' and 'feed'
- If icon string starts with 'fa' it is assumed to represent full CSS class
- Otherwise a brand icon is assumed - sensible fallback for most users
This commit is contained in:
Vitaly Potyarkin 2020-01-22 12:09:08 +03:00
commit 046f2fdd72
2 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,16 @@
{%- macro fa(icon) -%}
{%- set fa_special_icons = {
"feed": "fas fa-rss",
"rss": "fas fa-rss",
} -%}
{%- if icon in fa_special_icons -%}
{{ fa_special_icons[icon] }}
{%- elif icon.startswith("fa") -%}
{{ icon }}
{%- else -%}
fab fa-{{icon}}
{%- endif -%}
{%- endmacro -%}
<div class="row">
{% if SITEIMAGE %}
<div class="col-sm-4">
@ -28,7 +41,7 @@
{% if (LINKS or (DISPLAY_PAGES_ON_MENU and pages)) and loop.first %}
<li class=" list-inline-item text-muted">|</li>
{% endif %}
<li class="list-inline-item"><a class="{{ icon }}" href="{{ url(link) }}" target="_blank"></a></li>
<li class="list-inline-item"><a class="{{ fa(icon) }}" href="{{ url(link) }}" target="_blank"></a></li>
{% endfor %}
</ul>
{% endif %}