mirror of
https://github.com/softinio/softinio.com.git
synced 2025-09-03 10:36:42 -07:00
theme update and related improvements
This commit is contained in:
parent
57ddb18949
commit
f080a22e16
17 changed files with 249 additions and 114 deletions
|
@ -2,21 +2,23 @@
|
|||
|
||||
{%- 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 -%}
|
||||
{%- set blank_target = macros_target_attribute::target_attribute(new_tab=config.markdown.external_links_target_blank) -%}
|
||||
|
||||
{#- Feed icon -#}
|
||||
{%- set feed_url = feed_utils::get_feed_url() -%}
|
||||
{%- set should_show_feed = feed_utils::should_show_footer_feed_icon() == "true" -%}
|
||||
|
||||
{%- set should_show_footer_icons = should_show_feed or config.extra.socials or config.extra.email -%}
|
||||
|
||||
<footer>
|
||||
<section>
|
||||
<nav class="socials nav-navs">
|
||||
{%- if config.extra.socials %}
|
||||
{%- if should_show_footer_icons -%}
|
||||
<ul>
|
||||
{%- if config.generate_feed and config.extra.feed_icon -%}
|
||||
{%- if should_show_feed -%}
|
||||
<li>
|
||||
<a class="nav-links no-hover-padding social" rel="{{ rel_attributes }}" {{ blank_target }} href={{ get_url(path=config.feed_filename, lang=lang, trailing_slash=false) | safe }}>
|
||||
<img alt="feed" title="feed" src="{{ get_url(path='/social_icons/rss.svg') }}">
|
||||
<a class="nav-links no-hover-padding social" rel="{{ rel_attributes }}" {{ blank_target }} href="{{ get_url(path=feed_url, lang=lang, trailing_slash=false) | safe }}">
|
||||
<img loading="lazy" alt="feed" title="feed" src="{{ get_url(path='/social_icons/rss.svg') }}">
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
@ -43,18 +45,20 @@
|
|||
{%- else -%}
|
||||
<a class="nav-links no-hover-padding social" href="mailto:{{ config.extra.email | safe }}">
|
||||
{%- endif -%}
|
||||
<img alt="email" title="email" src="{{ get_url(path='social_icons/email.svg') }}">
|
||||
<img loading="lazy" alt="email" title="email" src="{{ get_url(path='social_icons/email.svg') }}">
|
||||
</a>
|
||||
</li>
|
||||
{%- endif -%}
|
||||
|
||||
{% for social in config.extra.socials %}
|
||||
<li>
|
||||
<a class="nav-links no-hover-padding social" rel="{{ rel_attributes }} me" {{ blank_target }} href={{ social.url | safe }}>
|
||||
<img alt={{ social.name }} title={{ social.name }} src="{{ get_url(path='social_icons/' ~ social.icon ~ '.svg') }}">
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{%- if config.extra.socials %}
|
||||
{% for social in config.extra.socials %}
|
||||
<li>
|
||||
<a class="nav-links no-hover-padding social" rel="{{ rel_attributes }} me" {{ blank_target }} href="{{ social.url | safe }}">
|
||||
<img loading="lazy" alt="{{ social.name }}" title="{{ social.name }}" src="{{ get_url(path='social_icons/' ~ social.icon ~ '.svg') }}">
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</nav>
|
||||
|
@ -108,4 +112,3 @@
|
|||
{% include "partials/search_modal.html" %}
|
||||
{%- endif -%}
|
||||
</footer>
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
{%- if macros_settings::evaluate_setting_priority(setting="enable_csp", page=page | default(value=""), section=section | default(value=""), default_global_value="true") == "true" -%}
|
||||
{%- include "partials/content_security_policy.html" -%}
|
||||
{%- endif -%}
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="base" content="{{ config.base_url | safe }}">
|
||||
|
||||
|
@ -11,21 +16,39 @@
|
|||
<link rel="icon" type="image/png" href="{{ get_url(path=config.extra.favicon) }}"/>
|
||||
{% endif %}
|
||||
{% if config.extra.favicon_emoji %}
|
||||
<link rel=icon href="{{ get_url(path=config.extra.favicon_emoji, trailing_slash=false) | safe }}">
|
||||
<link rel=icon href='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50%" x="50%" dominant-baseline="central" text-anchor="middle" font-size="88">{{ config.extra.favicon_emoji }}</text></svg>'>
|
||||
{% endif %}
|
||||
|
||||
{# Feed #}
|
||||
<link rel="alternate" type="application/atom+xml" title="{{ config.title | safe }}" href="{{ get_url(path="atom.xml",
|
||||
trailing_slash=false) }}">
|
||||
{# Feeds #}
|
||||
{% if config.generate_feeds | default(value=config.generate_feed) %}
|
||||
{% if config.feed_filenames %}
|
||||
{# Zola 0.19 and newer #}
|
||||
{% for feed in config.feed_filenames %}
|
||||
{% if feed == "atom.xml" %}
|
||||
<link rel="alternate" type="application/atom+xml" title="{{ config.title | safe }} - Atom Feed" href="{{ get_url(path=feed, trailing_slash=false) | safe }}">
|
||||
{% elif feed == "rss.xml" %}
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ config.title | safe }} - RSS Feed" href="{{ get_url(path=feed, trailing_slash=false) | safe }}">
|
||||
{% else %}
|
||||
<link rel="alternate" href="{{ get_url(path=feed, trailing_slash=false) | safe }}">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{# Older Zola versions #}
|
||||
{% set feed_url = config.feed_filename | default(value="atom.xml") %}
|
||||
<link rel="alternate" type="application/atom+xml" title="{{ config.title | safe }}" href="{{ get_url(path=feed_url, trailing_slash=false) | safe }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# CSS #}
|
||||
{# Load subset of glyphs for header. Avoids flashing issue in Firefox #}
|
||||
{% if config.extra.custom_subset and config.extra.custom_subset == true %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="custom_subset.css" , cachebust=true) }}">
|
||||
{% elif lang == 'en' %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="inter_subset_en.css", cachebust=true ) }}">
|
||||
{% elif lang == 'es' %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="inter_subset_es.css", cachebust=true ) }}">
|
||||
{% if config.extra.enable_subset %}
|
||||
{% if config.extra.custom_subset == true %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="custom_subset.css" , cachebust=true) }}">
|
||||
{% elif lang == 'en' %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="inter_subset_en.css", cachebust=true ) }}">
|
||||
{% elif lang == 'es' %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="inter_subset_es.css", cachebust=true ) }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# Define array of CSS files to load. main.css is always loaded. #}
|
||||
|
@ -70,8 +93,8 @@
|
|||
<meta name="description" content="{{ section.description }}" />
|
||||
<meta property="og:description" content="{{ section.description }}" />
|
||||
{%- elif page.summary %}
|
||||
<meta name="description" content="{{ page.summary | striptags | safe | trim_end_matches(pat=".") }}…" />
|
||||
<meta property="og:description" content="{{ page.summary | striptags | safe | trim_end_matches(pat=".") }}…" />
|
||||
<meta name="description" content="{{ page.summary | striptags | trim_end_matches(pat=".") | safe }}…" />
|
||||
<meta property="og:description" content="{{ page.summary | striptags | trim_end_matches(pat=".") | safe }}…" />
|
||||
{%- else %}
|
||||
<meta name="description" content="{{ config.description }}" />
|
||||
<meta property="og:description" content="{{ config.description }}" />
|
||||
|
@ -80,47 +103,13 @@
|
|||
|
||||
{% if is_404 %}
|
||||
<meta name="robots" content="noindex, follow" />
|
||||
{% else %}
|
||||
<!-- <meta name="robots" content="index, nofollow" /> -->
|
||||
<meta name="robots" content="index, follow" />
|
||||
<meta name="googlebot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
|
||||
<meta name="bingbot" content="index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1" />
|
||||
{% endif %}
|
||||
|
||||
<meta property="og:title" content="{{ page.title | default(value=config.title) | safe }}" />
|
||||
<meta property="og:type" content="article" />
|
||||
|
||||
{# Image for social media sharing #}
|
||||
{%- set social_media_card = macros_settings::evaluate_setting_priority(setting="social_media_card", page=page | default(value=""), section=section | default(value=""), default_global_value="") -%}
|
||||
{% if social_media_card %}
|
||||
{# Try to construct the image path relative to the current page #}
|
||||
{% set colocated_path = page.colocated_path | default(value="") %}
|
||||
{% set file_path = colocated_path ~ social_media_card %}
|
||||
|
||||
{# Fetch metadata to verify image existence at the relative path #}
|
||||
{%- set meta = get_image_metadata(path=file_path, allow_missing=true) -%}
|
||||
|
||||
{# Check if relative path exists, else try absolute path #}
|
||||
{% if meta %}
|
||||
{% set final_path = file_path %}
|
||||
{% else %}
|
||||
{# If the relative path didn't work, try fetching metadata for the absolute path #}
|
||||
{% set meta = get_image_metadata(path=social_media_card, allow_missing=true) %}
|
||||
{% if meta %}
|
||||
{% set final_path = social_media_card %}
|
||||
{% else %}
|
||||
{# Throw an error if the image doesn't exist at either path #}
|
||||
{{ throw(message="Could not get metadata for the specified social media card image in page " ~ page.path ~ ". Attempted relative path: '" ~ file_path ~ "' and absolute path: '" ~ social_media_card ~ "'. Ensure the file exists at one of these locations.") }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{# Generate the social media meta tags #}
|
||||
<meta property="og:image" content="{{ get_url(path=final_path, cachebust=true) }}" />
|
||||
<meta property="og:image:width" content="{{ meta.width }}" />
|
||||
<meta property="og:image:height" content="{{ meta.height }}" />
|
||||
<meta name="twitter:image" content="{{ get_url(path=final_path, cachebust=true) }}" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
{% endif %}
|
||||
{%- include "partials/social_media_images.html" -%}
|
||||
|
||||
{# Add og:locale and hreflang tags for multilingual sites #}
|
||||
{%- if config.languages | length > 0 and current_url %}
|
||||
|
@ -149,8 +138,6 @@
|
|||
|
||||
<meta property="og:site_name" content="{{ config.title }}">
|
||||
|
||||
{%- include "partials/content_security_policy.html" -%}
|
||||
|
||||
{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
|
||||
{# If JavaScript is disabled, hide the button. #}
|
||||
<noscript><link rel="stylesheet" href="{{ get_url(path='no_js.css') | safe }}"/></noscript>
|
||||
|
@ -162,6 +149,11 @@
|
|||
{%- include "partials/analytics.html" -%}
|
||||
{%- endif -%}
|
||||
|
||||
{# Socials #}
|
||||
{%- if config.extra.fediverse_creator -%}
|
||||
<meta name="fediverse:creator" content="@{{ config.extra.fediverse_creator["handle"] }}@{{ config.extra.fediverse_creator["domain"]}}" />
|
||||
{%- endif -%}
|
||||
|
||||
{# Search #}
|
||||
{%- if config.build_search_index -%}
|
||||
{%- if config.search.index_format -%}
|
||||
|
@ -191,4 +183,3 @@
|
|||
{%- include "partials/custom_header.html" -%}
|
||||
|
||||
</head>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue