Split base into multiple partials

This commit is contained in:
Alexandre Vicenzi 2022-07-08 20:36:43 +02:00
parent c96adc71f9
commit 98cfee4ce2
19 changed files with 199 additions and 198 deletions

View file

@ -45,6 +45,8 @@ USE_FOLDER_AS_CATEGORY = False
MAIN_MENU = True
HOME_HIDE_TAGS = True
GITHUB_CORNER_URL = "https://github.com/alexandrevicenzi/Flex"
SOCIAL = (
("github", "https://github.com/alexandrevicenzi/Flex"),
("rss", "/blog/feeds/all.atom.xml"),

View file

@ -12,9 +12,9 @@
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{% if page in hidden_pages %}
<meta name="robots" content="noindex, nofollow" />
<meta name="robots" content="noindex, nofollow" />
{% else %}
<meta name="robots" content="{{ ROBOTS }}" />
<meta name="robots" content="{{ ROBOTS }}" />
{% endif %}
{% if USE_GOOGLE_FONTS != False %}
@ -78,7 +78,7 @@
{% endif %}
{% if PLUGINS and 'pelican.plugins.search' in PLUGINS %}
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stork/stork-dark.css" />
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stork/stork-dark.css" />
{% endif %}
<link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/fontawesome.css">
@ -89,38 +89,14 @@
<link rel="stylesheet" type="text/css" href="{% if main_siteurl is defined %}{{ main_site }}{% else %}{{ SITEURL }}{% endif %}/{{ CUSTOM_CSS }}">
{% endif %}
{% if FEED_ALL_ATOM %}
<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom">
{% endif %}
{% include "partial/icon.html" %}
{% if FEED_ALL_RSS %}
<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS">
{% endif %}
{% include "partial/color.html" %}
{% if FAVICON %}
<link rel="shortcut icon" href="{{ FAVICON }}" type="image/x-icon">
<link rel="icon" href="{{ FAVICON }}" type="image/x-icon">
{% endif %}
{% include "partial/feed.html" %}
{% if GOOGLE_ANALYTICS %}
{% include "partial/ga.html" %}
{% endif %}
{% if GOOGLE_GLOBAL_SITE_TAG %}
{% include "partial/ggst.html" %}
{% endif %}
{% if BROWSER_COLOR %}
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="{{ BROWSER_COLOR }}">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="{{ BROWSER_COLOR }}">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- Microsoft EDGE -->
<meta name="msapplication-TileColor" content="{{ BROWSER_COLOR }}">
{% endif %}
{% include "partial/ga.html" %}
{% include "partial/ggst.html" %}
{% if not PLUGINS or 'seo' not in PLUGINS %}
{% if REL_CANONICAL %}
@ -155,103 +131,15 @@
});
</script>
{% endif %}
{% if GOOGLE_TAG_MANAGER %}
{% include "partial/gtm.html" %}
{% endif %}
{% if MICROSOFT_CLARITY %}
{% include "partial/clarity.html" %}
{% endif %}
{% include "partial/gtm.html" %}
{% include "partial/clarity.html" %}
</head>
<body {% if not THEME_COLOR_AUTO_DETECT_BROWSER_PREFERENCE %}class="{{ THEME_COLOR|default('light') }}-theme"{% endif %}>
{% if GOOGLE_TAG_MANAGER %}
{% include "partial/gtm_noscript.html" %}
{% endif %}
<aside>
<div>
<a href="{{ SITEURL }}/">
{% if SITELOGO %}
<img src="{{ SITELOGO }}" alt="{{ SITETITLE }}" title="{{ SITETITLE }}">
{% else %}
<img src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png" alt="{{ SITETITLE }}" title="{{ SITETITLE }}">
{% endif %}
</a>
{% include "partial/gtm_noscript.html" %}
<h1>
<a href="{{ SITEURL }}/">{{ SITETITLE }}</a>
</h1>
{% include "partial/sidebar.html" %}
{% if SITESUBTITLE %}<p>{{ SITESUBTITLE }}</p>{% endif %}
{% if PLUGINS and ('tipue_search' in PLUGINS or 'pelican.plugins.tipue_search' in PLUGINS)%}
<form class="navbar-search" action="{{ SITEURL }}/search.html" role="search">
<input type="text" name="q" id="tipue_search_input" placeholder="{{ _('Search...') }}">
</form>
{% endif %}
{% if PLUGINS and 'pelican.plugins.search' in PLUGINS %}
<div class="stork-wrapper-dark">
<input class="stork-input" type="text" name="q" data-stork="sitesearch" placeholder="{{ _('Search...') }}"/>
<div class="stork-output" data-stork="sitesearch-output"></div>
</div>
{% endif %}
{% if (pages and DISPLAY_PAGES_ON_MENU) or LINKS %}
<nav>
<ul class="list">
{# Open links in new window depending on the LINKS_IN_NEW_TAB setting #}
{% macro get_target(link) -%}
{%- if LINKS_IN_NEW_TAB in ('all', true) -%}
_blank
{%- elif LINKS_IN_NEW_TAB == "external" and not link.startswith("/") and not link.startswith(SITEURL) -%}
_blank
{%- else -%}
_self
{%- endif -%}
{%- endmacro %}
{% if PAGES_SORT_ATTRIBUTE -%}
{% set pages = pages|sort(attribute=PAGES_SORT_ATTRIBUTE) %}
{%- endif %}
{% if DISPLAY_PAGES_ON_MENU %}
{% for page in pages %}
<li>
<a target="{{ get_target(SITEURL) }}"
href="{{ SITEURL }}/{{ page.url }}{% if not DISABLE_URL_HASH %}#{{ page.slug }}{% endif %}">
{{ page.title }}
</a>
</li>
{% endfor %}
{% endif %}
{% for name, link in LINKS %}
<li>
<a target="{{ get_target(link) }}" href="{{ link }}" >{{ name }}</a>
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
<ul class="social">
{% for name, link in SOCIAL %}
<li>
<a {% if name == 'mastodon' %}rel="me"{% endif %} class="sc-{{ name }}" href="{{ link }}" target="_blank">
<i class="{% if name in ['envelope', 'rss'] %}fas{% else %}fab{% endif %} fa-{{ name }}"></i>
</a>
</li>
{% endfor %}
</ul>
</div>
{% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.aside %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle ads-aside"
data-ad-client="{{ GOOGLE_ADSENSE.ca_id }}"
data-ad-slot="{{ GOOGLE_ADSENSE.ads.aside }}"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
</aside>
<main>
{% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.main_menu %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
@ -263,56 +151,21 @@
</script>
{% endif %}
{% if MAIN_MENU %}
<nav>
<a href="{{ SITEURL }}/">{{ _('Home') }}</a>
{% for title, link in MENUITEMS %}
<a href="{{ link }}">{{ _(title) }}</a>
{% endfor %}
{% if FEED_ALL_ATOM %}
<a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}">{{ _('Atom') }}</a>
{% endif %}
{% if FEED_ALL_RSS %}
<a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}">{{ _('RSS') }}</a>
{% endif %}
</nav>
{% endif %}
{% include "partial/nav.html" %}
{% block content %}
{% endblock %}
<footer>
{% if CC_LICENSE %}
{% include "partial/cc_license.html" %}
{% else %}
{% include "partial/copyright.html" %}
{% endif %}
</footer>
{% include "partial/footer.html" %}
</main>
{% if GUAGES %}
{% include "partial/guages.html" %}
{% endif %}
{% if ADD_THIS_ID %}
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid={{ ADD_THIS_ID }}" async="async"></script>
{% endif %}
{% if (PIWIK_URL and PIWIK_SITE_ID) or (MATOMO_URL and MATOMO_SITE_ID) %}
{% include "partial/matomo.html" %}
{% endif %}
{% include "partial/jsonld.html" %}
{% if GITHUB_CORNER_URL %}
{% include 'partial/github.html' %}
{% endif %}
{% include "partial/guages.html" %}
{% include "partial/addthis.html" %}
{% include "partial/matomo.html" %}
{% include 'partial/github.html' %}
{% include 'partial/stork.html' %}
{% block additional_js %}{% endblock %}
{% include 'partial/stork_search.html' %}
</body>
</html>

View file

@ -0,0 +1,3 @@
{% if ADD_THIS_ID %}
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid={{ ADD_THIS_ID }}" async="async"></script>
{% endif %}

View file

@ -1,7 +1,9 @@
{% if MICROSOFT_CLARITY %}
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "{{ MICROSOFT_CLARITY }}");
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "{{ MICROSOFT_CLARITY }}");
</script>
{% endif %}

View file

@ -0,0 +1,11 @@
{% if BROWSER_COLOR %}
<!-- Chrome, Firefox OS and Opera -->
<meta name="theme-color" content="{{ BROWSER_COLOR }}">
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="{{ BROWSER_COLOR }}">
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- Microsoft EDGE -->
<meta name="msapplication-TileColor" content="{{ BROWSER_COLOR }}">
{% endif %}

View file

@ -0,0 +1,7 @@
{% if FEED_ALL_ATOM %}
<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom">
{% endif %}
{% if FEED_ALL_RSS %}
<link href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS">
{% endif %}

View file

@ -0,0 +1,7 @@
<footer>
{% if CC_LICENSE %}
{% include "partial/cc_license.html" %}
{% else %}
{% include "partial/copyright.html" %}
{% endif %}
</footer>

View file

@ -1,4 +1,4 @@
<!-- Google Analytics -->
{% if GOOGLE_ANALYTICS %}
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@ -8,4 +8,4 @@
ga('create', '{{ GOOGLE_ANALYTICS }}', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
{% endif %}

View file

@ -1,4 +1,4 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
{% if GOOGLE_GLOBAL_SITE_TAG %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_GLOBAL_SITE_TAG }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
@ -7,4 +7,4 @@
gtag('config', '{{ GOOGLE_GLOBAL_SITE_TAG }}');
</script>
<!-- End of Global site tag (gtag.js) - Google Analytics -->
{% endif %}

View file

@ -1,4 +1,5 @@
<a href="{{ GITHUB_CORNER_URL }}" class="github-corner" aria-label="View source on Github">
{% if GITHUB_CORNER_URL %}
<a href="{{ GITHUB_CORNER_URL }}" target="_blank" class="github-corner" aria-label="View source on Github">
<svg width="80"
height="80"
viewBox="0 0 250 250"
@ -16,4 +17,4 @@
</path>
</svg>
</a>
<style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
{% endif %}

View file

@ -1,4 +1,4 @@
<!-- Google Tag Manager -->
{% if GOOGLE_TAG_MANAGER %}
<script>
(function(w,d,s,l,i){
w[l]=w[l]||[];
@ -9,4 +9,4 @@
f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ GOOGLE_TAG_MANAGER }}');
</script>
<!-- End Google Tag Manager -->
{% endif %}

View file

@ -1,5 +1,5 @@
<!-- Google Tag Manager -->
{% if GOOGLE_TAG_MANAGER %}
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id={{ GOOGLE_TAG_MANAGER }}" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager -->
{% endif %}

View file

@ -1,4 +1,4 @@
<!-- Gauges -->
{% if GUAGES %}
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
@ -13,4 +13,5 @@
s.parentNode.insertBefore(t, s);
})();
</script>
<!-- End Gauges -->
{% endif %}

View file

@ -0,0 +1,4 @@
{% if FAVICON %}
<link rel="shortcut icon" href="{{ FAVICON }}" type="image/x-icon">
<link rel="icon" href="{{ FAVICON }}" type="image/x-icon">
{% endif %}

View file

@ -1,4 +1,4 @@
<!-- Matomo -->
{% if (PIWIK_URL and PIWIK_SITE_ID) or (MATOMO_URL and MATOMO_SITE_ID) %}
<script type="text/javascript">
var _paq = window._paq || [];
_paq.push(['trackPageView']);
@ -12,4 +12,4 @@
})();
</script>
<noscript><p><img src="https://{{ MATOMO_URL or PIWIK_URL }}/matomo.php?idsite={{ MATOMO_SITE_ID or PIWIK_SITE_ID }}&rec=1" style="border:0" alt="" /></p></noscript>
<!-- End Matomo Code -->
{% endif %}

View file

@ -0,0 +1,17 @@
{% if MAIN_MENU %}
<nav>
<a href="{{ SITEURL }}/">{{ _('Home') }}</a>
{% for title, link in MENUITEMS %}
<a href="{{ link }}">{{ _(title) }}</a>
{% endfor %}
{% if FEED_ALL_ATOM %}
<a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_ATOM }}">{{ _('Atom') }}</a>
{% endif %}
{% if FEED_ALL_RSS %}
<a href="{{ FEED_DOMAIN }}/{{ FEED_ALL_RSS }}">{{ _('RSS') }}</a>
{% endif %}
</nav>
{% endif %}

View file

@ -0,0 +1,92 @@
<aside>
<div>
<a href="{{ SITEURL }}/">
{% if SITELOGO %}
<img src="{{ SITELOGO }}" alt="{{ SITETITLE }}" title="{{ SITETITLE }}">
{% else %}
<img src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png" alt="{{ SITETITLE }}" title="{{ SITETITLE }}">
{% endif %}
</a>
<h1>
<a href="{{ SITEURL }}/">{{ SITETITLE }}</a>
</h1>
{% if SITESUBTITLE %}
<p>{{ SITESUBTITLE }}</p>
{% endif %}
{% if PLUGINS %}
{% if ('tipue_search' in PLUGINS or 'pelican.plugins.tipue_search' in PLUGINS) %}
<form class="navbar-search" action="{{ SITEURL }}/search.html" role="search">
<input type="text" name="q" id="tipue_search_input" placeholder="{{ _('Search...') }}">
</form>
{% elif 'pelican.plugins.search' in PLUGINS %}
<div class="stork-wrapper-dark">
<input class="stork-input" type="text" name="q" data-stork="sitesearch" placeholder="{{ _('Search...') }}"/>
<div class="stork-output" data-stork="sitesearch-output"></div>
</div>
{% endif %}
{% endif %}
{% if (pages and DISPLAY_PAGES_ON_MENU) or LINKS %}
<nav>
<ul class="list">
{# Open links in new window depending on the LINKS_IN_NEW_TAB setting #}
{% macro get_target(link) -%}
{%- if LINKS_IN_NEW_TAB in ('all', true) -%}
_blank
{%- elif LINKS_IN_NEW_TAB == "external" and not link.startswith("/") and not link.startswith(SITEURL) -%}
_blank
{%- else -%}
_self
{%- endif -%}
{%- endmacro %}
{% if PAGES_SORT_ATTRIBUTE -%}
{% set pages = pages|sort(attribute=PAGES_SORT_ATTRIBUTE) %}
{%- endif %}
{% if DISPLAY_PAGES_ON_MENU %}
{% for page in pages %}
<li>
<a target="{{ get_target(SITEURL) }}"
href="{{ SITEURL }}/{{ page.url }}{% if not DISABLE_URL_HASH %}#{{ page.slug }}{% endif %}">
{{ page.title }}
</a>
</li>
{% endfor %}
{% endif %}
{% for name, link in LINKS %}
<li>
<a target="{{ get_target(link) }}" href="{{ link }}" >{{ name }}</a>
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
{% if SOCIAL %}
<ul class="social">
{% for name, link in SOCIAL %}
<li>
<a {% if name == 'mastodon' %}rel="me"{% endif %} class="sc-{{ name }}" href="{{ link }}" target="_blank">
<i class="{% if name in ['envelope', 'rss'] %}fas{% else %}fab{% endif %} fa-{{ name }}"></i>
</a>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% if GOOGLE_ADSENSE and GOOGLE_ADSENSE.ads.aside %}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle ads-aside"
data-ad-client="{{ GOOGLE_ADSENSE.ca_id }}"
data-ad-slot="{{ GOOGLE_ADSENSE.ads.aside }}"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{% endif %}
</aside>

View file

@ -0,0 +1,13 @@
{% if PLUGINS and 'pelican.plugins.search' in PLUGINS %}
{% if STORK_VERSION %}
<script src="https://files.stork-search.net/releases/v{{ STORK_VERSION }}/stork.js"></script>
<script>
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", {showProgress: false})
</script>
{% else %}
<script src="{{ SITEURL }}/static/stork.js"></script>
<script>
stork.initialize("{{ SITEURL }}/static/stork.wasm")
</script>
{% endif %}
{% endif %}

View file

@ -1,12 +0,0 @@
{% if PLUGINS and 'pelican.plugins.search' in PLUGINS %}
{% if STORK_VERSION %}
<script src="https://files.stork-search.net/releases/v{{ STORK_VERSION }}/stork.js"></script>
<script>
{% else %}
<script src="{{ SITEURL }}/static/stork.js"></script>
<script>
stork.initialize("{{ SITEURL }}/static/stork.wasm")
{% endif %}
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", {showProgress: false})
</script>
{% endif %}