New refreshed blog for 2024 using Zola

This commit is contained in:
Salar Rahmanian 2024-02-10 18:04:44 -08:00
parent a23dd16b89
commit 46c2405d9e
125 changed files with 1356 additions and 1337 deletions

View file

@ -0,0 +1,34 @@
{% if config.extra.favicon180 %}
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="{{ get_url(path=config.extra.favicon180) }}"/>
{% endif %}
{% if config.extra.favicon32 %}
<link rel="icon" type="image/png" sizes="32x32" href="{{ get_url(path=config.extra.favicon32) }}"/>
{% endif %}
{% if config.extra.favicon16 %}
<link rel="icon" type="image/png" sizes="16x16" href="{{ get_url(path=config.extra.favicon16) }}"/>
{% endif %}
{%- if config.author %}
<meta name="author" content="{{ config.author }}" />
{%- endif %}
<meta name="copyright" content="{{ config.author }}" />
{%- if page.extra.keywords and config.extra.keywords %}
<meta name="keywords" content="{{ page.extra.keywords }}, {{ config.extra.keywords }}" />
{%- elif page.extra.keywords %}
<meta name="keywords" content="{{ page.extra.keywords }}" />
{%- elif config.extra.keywords %}
<meta name="keywords" content="{{ config.extra.keywords }}" />
{%- endif %}
{%- if config.extra.google %}
<meta name="google-site-verification" content="{{ config.extra.google | safe }}" />
{%- endif %}
{%- if config.extra.bing %}
<meta name="msvalidate.01" content="{{ config.extra.bing | safe}}" />
{%- endif %}
<meta property="twitter:title" content="{{ page.title | default(value=config.title) | safe }}" />
{%- if config.extra.twitter_meta %}
<meta name="twitter:site" content="@{{ config.extra.twitter_meta }}" />
<meta name="twitter:creator" content="@{{ config.extra.twitter_meta }}" />
{%- endif %}

View file

@ -0,0 +1,106 @@
{%- set separator = config.extra.separator | default(value="•") -%}
{%- 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 -%}
<footer>
<section>
<nav class="socials nav-navs">
{%- if config.extra.socials %}
<ul>
{%- if config.generate_feed and config.extra.feed_icon -%}
<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>
</li>
{%- endif -%}
{# Mail icon #}
{%- if config.extra.email -%}
{%- set email_already_encoded = (config.extra.email is not containing("@")) -%}
{%- set email_needs_decoding = email_already_encoded or config.extra.encode_plaintext_email -%}
{%- if email_already_encoded -%}
{%- set encoded_email = config.extra.email -%}
{# Verify the pre-encoded e-mail is valid (i.e. contains an '@') #}
{%- set decoded_email = encoded_email | base64_decode -%}
{%- if '@' not in decoded_email -%}
{{ throw(message="ERROR: The provided e-mail appears to be base64-encoded, but does not decode to a valid e-mail address.")}}
{%- endif -%}
{%- elif config.extra.encode_plaintext_email -%}
{%- set encoded_email = config.extra.email | base64_encode -%}
{%- endif -%}
<li class="{% if email_needs_decoding %}js{% endif %}">
{%- if email_needs_decoding -%}
<a class="nav-links no-hover-padding social" href="#" data-encoded-email="{{ encoded_email | safe }}">
{%- 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') }}">
</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 %}
</ul>
{% endif %}
</nav>
{# Footer menu #}
<nav class="nav-navs">
{%- if config.extra.footer_menu %}
<small>
<ul>
{% for menu in config.extra.footer_menu %}
<li>
{%- set trailing_slash = menu.trailing_slash | default(value=true) -%}
{%- if menu.url == "sitemap.xml" -%}
{%- set url = get_url(path=menu.url, trailing_slash=trailing_slash) -%}
{%- elif menu.url is starting_with("http") -%}
{%- if menu.trailing_slash -%}
{%- set url = menu.url ~ "/" -%}
{%- else -%}
{%- set url = menu.url -%}
{%- endif -%}
{%- else -%}
{%- set url = get_url(path=menu.url, lang=lang, trailing_slash=trailing_slash) -%}
{%- endif -%}
<a class="nav-links no-hover-padding" href="{{ url }}">
{{ macros_translate::translate(key=menu.name, default=menu.name, language_strings=language_strings) }}
</a>
</li>
{% endfor %}
</ul>
</small>
{% endif %}
</nav>
<div class="credits">
<small>
{% include "partials/copyright.html" %}
Subscribe to <a href="/subscribe" target="_self">Salar Rahmanian&#39;s Newsletter</a> to be informed of new posts.
</small>
</div>
</section>
{# Load the decoding script if email is encoded #}
{%- if email_needs_decoding -%}
<script src="{{ get_url(path='js/decodeMail.min.js') }}" async></script>
{%- endif -%}
</footer>

View file

@ -0,0 +1,166 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{# Site title #}
<title>{%- include "partials/title.html" -%}</title>
{# Favicon #}
{% if config.extra.favicon %}
<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 }}">
{% endif %}
{# Feed #}
<link rel="alternate" type="application/atom+xml" title="{{ config.title | safe }}" href="{{ get_url(path="atom.xml",
trailing_slash=false) }}">
{# 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 ) }}">
{% endif %}
{# Define array of CSS files to load. main.css is always loaded. #}
{%- set stylesheets = [ "main.css" ] -%}
{# Load extra CSS files from config.toml #}
{%- if config.extra.stylesheets -%}
{%- set stylesheets = stylesheets | concat(with=config.extra.stylesheets) -%}
{%- endif -%}
{# Load extra CSS files from page metadata #}
{%- if page.extra.stylesheets -%}
{%- set stylesheets = stylesheets | concat(with=page.extra.stylesheets) -%}
{%- endif -%}
{# Load extra CSS for custom skin #}
{%- if config.extra.skin -%}
{%- set stylesheets = stylesheets | concat(with='skins/' ~ config.extra.skin ~ '.css') -%}
{%- endif -%}
{# Load all stylesheets #}
{%- for stylesheet in stylesheets %}
<link rel="stylesheet" href="{{ get_url(path=stylesheet, cachebust=true) | safe }}" />
{%- endfor %}
<meta name="color-scheme" content="{%- if config.extra.theme_switcher -%}light dark{%- elif config.extra.default_theme -%}{{config.extra.default_theme}}{%- else -%}light{%- endif -%}" />
{%- if config.extra.browser_theme_color and config.extra.browser_theme_color is iterable -%}
{# Handle array values: theme_color[0] for light mode, theme_color[1] for dark mode #}
<meta name="theme-color" media="(prefers-color-scheme: light)" content="{{ config.extra.browser_theme_color[0] }}" />
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="{{ config.extra.browser_theme_color[1] }}" />
{%- elif config.extra.browser_theme_color -%}
{# Handle single value #}
<meta name="theme-color" content="{{ config.extra.browser_theme_color }}" />
{%- endif -%}
{%- if page.description %}
<meta name="description" content="{{ page.description }}" />
<meta property="og:description" content="{{ page.description }}" />
<meta name="twitter:description" content="{{ page.description }}" />
{%- elif section.description %}
<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=".") }}" />
{%- else %}
<meta name="description" content="{{ config.description }}" />
<meta property="og:description" content="{{ config.description }}" />
<meta name="twitter:description" content="{{ config.description}}" />
{%- endif %}
{% 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 %}
{# Add og:locale and hreflang tags for multilingual sites #}
{%- if config.languages | length > 0 and current_url %}
{%- include "partials/multilingual_tags.html" -%}
{%- else -%}
<meta property="og:locale" content="{{ macros_translate::translate(key="date_locale", default="en_GB", language_strings=language_strings) }}" />
{%- endif %}
{# Set canonical URL #}
{%- if current_url -%}
{%- if page.extra.canonical_url or section.extra.canonical_url -%}
{%- set canonical_url = page.extra.canonical_url | default(value=section.extra.canonical_url) -%}
{%- elif config.extra.base_canonical_url -%}
{%- set canonical_url = current_url | replace(from=config.base_url, to=config.extra.base_canonical_url) -%}
{%- endif -%}
{%- endif -%}
{# Add canonical URL, if set #}
{%- if canonical_url -%}
<link rel="canonical" href="{{ canonical_url }}" />
<meta property="og:url" content="{{ canonical_url }}" />
{%- elif current_url -%}
<meta property="og:url" content="{{ current_url }}" />
<meta name="twitter:url" content="{{ current_url }}" />
{%- endif -%}
<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>
<script type="text/javascript" src="{{ get_url(path='js/initializeTheme.min.js') | safe }}"></script>
<script defer src="{{ get_url(path='js/themeSwitcher.min.js', trailing_slash=false) | safe }}"></script>
{%- endif -%}
{%- if config.extra.analytics.service -%}
{%- include "partials/analytics.html" -%}
{%- endif -%}
{%- include "partials/custom_header.html" -%}
</head>