diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2024-06-19 14:44:10 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2024-06-19 14:44:10 +0200 |
commit | e0a989555b6bef9173088da9e0b980338a88ce0c (patch) | |
tree | 3e35bc65664e881d62cf14970d482884b80289f7 /theme/bulma/templates | |
parent | 3b3c4db1bdd29b46a23051fc5427197ce2831764 (diff) |
Swiched the theme to bulma-css
Diffstat (limited to 'theme/bulma/templates')
-rw-r--r-- | theme/bulma/templates/applications.html | 22 | ||||
-rw-r--r-- | theme/bulma/templates/article.html | 50 | ||||
-rw-r--r-- | theme/bulma/templates/base.html | 71 | ||||
-rw-r--r-- | theme/bulma/templates/index.html | 50 | ||||
-rw-r--r-- | theme/bulma/templates/page.html | 29 | ||||
-rw-r--r-- | theme/bulma/templates/partial/cc_license.html | 31 | ||||
-rw-r--r-- | theme/bulma/templates/partial/copyright.html | 10 | ||||
-rw-r--r-- | theme/bulma/templates/partial/footer.html | 7 | ||||
-rw-r--r-- | theme/bulma/templates/partial/nav.html | 17 | ||||
-rw-r--r-- | theme/bulma/templates/partial/pagination.html | 14 | ||||
-rw-r--r-- | theme/bulma/templates/partial/sidebar.html | 78 | ||||
-rw-r--r-- | theme/bulma/templates/partial/translations.html | 10 |
12 files changed, 389 insertions, 0 deletions
diff --git a/theme/bulma/templates/applications.html b/theme/bulma/templates/applications.html new file mode 100644 index 0000000..8713d38 --- /dev/null +++ b/theme/bulma/templates/applications.html @@ -0,0 +1,22 @@ +{% extends "page.html" %} + +{% block after_content %} +{% for page in hidden_pages|selectattr("date")|sort(reverse=true,attribute="date") %} +{% for tag in page.tags if "application" == tag.name %} + <h2><a href="{{ SITEURL }}/{{ page.url }}{% if not DISABLE_URL_HASH %}#{{ page.slug }}{% endif %}">{{ page.title }}</a></h2> + <div class="content"> + {% if summarise or page.metadata['summary'] or SUMMARY_MAX_LENGTH %} + {% if page.featured_image %} + <img src="{{ page.featured_image }}"> + {% endif %} + {{ page.summary }} + {% endif %} + </div> +{% endfor %} + {% if not loop.last %} + <hr /> + {% endif %} +{% endfor %} +{{ super() }} + +{% endblock %} diff --git a/theme/bulma/templates/article.html b/theme/bulma/templates/article.html new file mode 100644 index 0000000..bc78ec9 --- /dev/null +++ b/theme/bulma/templates/article.html @@ -0,0 +1,50 @@ +{% extends "base.html" %} +{% block html_lang %}{{ article.lang }}{% endblock %} + +{% block title %}{{ SITENAME }} - {{ article.title|striptags }}{% endblock %} + +{% block head %} + {{ super() }} + + {% import 'translations.html' as translations with context %} + {% if translations.entry_hreflang(article) %} + {{ translations.entry_hreflang(article) }} + {% endif %} + + {% if article.description %} + <meta name="description" content="{{article.description}}" /> + {% endif %} + + {% for tag in article.tags %} + <meta name="tags" content="{{tag}}" /> + {% endfor %} + +{% endblock %} + +{% block content %} +<section id="content" class="body content"> + <header> + <h2 class="entry-title"> + <a href="{{ SITEURL }}/{{ article.url }}" rel="bookmark" + title="Permalink to {{ article.title|striptags }}">{{ article.title }}</a></h2> + {% import 'translations.html' as translations with context %} + {{ translations.translations_for(article) }} + </header> + <footer class="post-info is-size-5 has-text-primary-light"> + {{ _('Posted on %(when)s in %(category)s', + when=article.locale_date, + category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }} + {% if article.tags %} + <div class="tags"> + Tags: + {% for tag in article.tags %} + <a href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a> + {% endfor %} + </div> + {% endif %} + </footer><!-- /.post-info --> + <div class="entry-content"> + {{ article.content }} + </div><!-- /.entry-content --> +</section> +{% endblock %} diff --git a/theme/bulma/templates/base.html b/theme/bulma/templates/base.html new file mode 100644 index 0000000..6b281d6 --- /dev/null +++ b/theme/bulma/templates/base.html @@ -0,0 +1,71 @@ +<!DOCTYPE html> +<html lang="{% block html_lang %}{{ DEFAULT_LANG }}{% endblock html_lang %}"> +<head> + {% block head %} + <meta charset="utf-8" /> + <meta name="generator" content="Pelican" /> + <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/style.min.css"> + {% if FEED_ALL_ATOM %} + <link href="{{ FEED_DOMAIN }}/{% if FEED_ALL_ATOM_URL %}{{ FEED_ALL_ATOM_URL }}{% else %}{{ FEED_ALL_ATOM }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Full Atom Feed" /> + {% endif %} + {% if FEED_ALL_RSS %} + <link href="{{ FEED_DOMAIN }}/{% if FEED_ALL_RSS_URL %}{{ FEED_ALL_RSS_URL }}{% else %}{{ FEED_ALL_RSS }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Full RSS Feed" /> + {% endif %} + {% if FEED_ATOM %} + <link href="{{ FEED_DOMAIN }}/{%if FEED_ATOM_URL %}{{ FEED_ATOM_URL }}{% else %}{{ FEED_ATOM }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom Feed" /> + {% endif %} + {% if FEED_RSS %} + <link href="{{ FEED_DOMAIN }}/{% if FEED_RSS_URL %}{{ FEED_RSS_URL }}{% else %}{{ FEED_RSS }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" /> + {% endif %} + {% if CATEGORY_FEED_ATOM and category %} + <link href="{{ FEED_DOMAIN }}/{% if CATEGORY_FEED_ATOM_URL %}{{ CATEGORY_FEED_ATOM_URL.format(slug=category.slug) }}{% else %}{{ CATEGORY_FEED_ATOM.format(slug=category.slug) }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Categories Atom Feed" /> + {% endif %} + {% if CATEGORY_FEED_RSS and category %} + <link href="{{ FEED_DOMAIN }}/{% if CATEGORY_FEED_RSS_URL %}{{ CATEGORY_FEED_RSS_URL.format(slug=category.slug) }}{% else %}{{ CATEGORY_FEED_RSS.format(slug=category.slug) }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Categories RSS Feed" /> + {% endif %} + {% if TAG_FEED_ATOM and tag %} + <link href="{{ FEED_DOMAIN }}/{% if TAG_FEED_ATOM_URL %}{{ TAG_FEED_ATOM_URL.format(slug=tag.slug) }}{% else %}{{ TAG_FEED_ATOM.format(slug=tag.slug) }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Tags Atom Feed" /> + {% endif %} + {% if TAG_FEED_RSS and tag %} + <link href="{{ FEED_DOMAIN }}/{% if TAG_FEED_RSS_URL %}{{ TAG_FEED_RSS_URL.format(slug=tag.slug) }}{% else %}{{ TAG_FEED_RSS.format(slug=tag.slug) }}{% endif %}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} Tags RSS Feed" /> + {% endif %} + {% endblock head %} + <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/fontawesome.css"> + <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/brands.css"> + <link rel="stylesheet" type="text/css" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/font-awesome/css/solid.css"> + <script> + const theme = localStorage.getItem('theme'); + if (theme === "dark") { + document.documentElement.setAttribute('data-theme', 'dark'); + } else { + document.documentElement.setAttribute('data-theme', 'light'); + } + + function modeSwitcher() { + let currentMode = document.documentElement.getAttribute('data-theme'); + if (currentMode === "dark") { + document.documentElement.setAttribute('data-theme', 'light'); + window.localStorage.setItem('theme', 'light'); + } else { + document.documentElement.setAttribute('data-theme', 'dark'); + window.localStorage.setItem('theme', 'dark'); + } + } + </script> + <title>{{ SITENAME }}{% block title %}{% endblock %}</title> +</head> + +<body id="index" class="home"> + <main class="columns"> + <div class="column is-3 has-text-centered aside p-6"> + {% include "partial/sidebar.html" %} + {% include "partial/nav.html" %} + </div> + <div class="column is-9 p-6"> + {% block content %} + {% endblock %} + {% include "partial/footer.html" %} + </div> + </main> +</body> +</html> diff --git a/theme/bulma/templates/index.html b/theme/bulma/templates/index.html new file mode 100644 index 0000000..36cb150 --- /dev/null +++ b/theme/bulma/templates/index.html @@ -0,0 +1,50 @@ +{% extends "base.html" %} + +{% block content %} + +{% for article in articles_page.object_list %} +<article> + <header> + <h2><a href="{{ SITEURL }}/{{ article.url }}{% if not DISABLE_URL_HASH %}#{{ article.slug }}{% endif %}">{{ article.title }}</a></h2> + <p> + {{ _('Posted on %(when)s in %(category)s', + when=article.locale_date, + category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }} + + {% if article.tags and not HOME_HIDE_TAGS %} + • {{ _('Tagged with') }} + {% for tag in article.tags %} + <a class="tag" href="{{ SITEURL }}/{{ tag.url }}">{{ tag }}</a>{% if not loop.last %},{% endif %} + {% endfor %} + {% endif %} + + {% if PLUGINS and 'post_stats' in PLUGINS %} + • {{ _('%(minutes)s min read', minutes=article.stats['read_mins']) }} + {% endif %} + </p> + </header> + <div class="content"> + {% if summarise or article.metadata['summary'] or SUMMARY_MAX_LENGTH %} + {% if article.featured_image %} + <img src="{{ article.featured_image }}"> + {% endif %} + <div>{{ article.summary }}</div> + {% if article.content != article.summary %} + <br> + <a class="button" + href="{{ SITEURL }}/{{ article.url }}{% if not DISABLE_URL_HASH %}#{{ article.slug }}{% endif %}"> + {{ _('Continue reading') }} + </a> + {% endif %} + {% else %} + {{ article.content }} + {% endif %} + </div> + {% if not loop.last %} + <hr /> + {% endif %} +</article> +{% endfor %} + +{% include "partial/pagination.html" %} +{% endblock %} diff --git a/theme/bulma/templates/page.html b/theme/bulma/templates/page.html new file mode 100644 index 0000000..a4eacf8 --- /dev/null +++ b/theme/bulma/templates/page.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% block meta %} +{{ super() }} + +{% if page.translations -%} +<link rel="alternate" href="{{ SITEURL }}/{{ page.url }}" hreflang="{{ page.lang }}" /> +{% for p in page.translations %} +<link rel="alternate" href="{{ SITEURL }}/{{ p.url }}" hreflang="{{ p.lang }}" /> +{% endfor %} +{% endif %} +{% endblock %} + +{% block title %} – {{ page.title|striptags|escape }}{% endblock %} + +{% block content %} +<article class="single content"> + <header> + {% import 'partial/translations.html' as translations with context %} + {{ translations.translations_for(page) }} + <h1 id="{{ page.slug }}">{{ page.title }}</h1> + </header> + <div> + {% block before_content %}{% endblock %} + {% block page_content %}{{ page.content }}{% endblock %} + {% block after_content %}{% endblock %} + </div> +</article> +{% endblock %} diff --git a/theme/bulma/templates/partial/cc_license.html b/theme/bulma/templates/partial/cc_license.html new file mode 100644 index 0000000..756cc49 --- /dev/null +++ b/theme/bulma/templates/partial/cc_license.html @@ -0,0 +1,31 @@ +<p> + {% set cc_slug = CC_LICENSE['slug'] %} + {% set cc_name = CC_LICENSE['name'] %} + {% set cc_version = CC_LICENSE['version'] %} + {% set cc_lang = CC_LICENSE['language'] or "en_US" %} + {% set cc_url = "http://creativecommons.org/licenses/{}/{}/deed.{}".format(cc_slug, cc_version, cc_lang) %} + © {{ COPYRIGHT_YEAR }} {{ COPYRIGHT_NAME }} - {{ _('This work is licensed under a %(cc)s', + cc='<a rel="license" href="{}" target="_blank">{}</a>'.format(cc_url, cc_name)|safe) }} +</p> +{% include "partial/flex.html" %} +<p> + {% if CC_LICENSE['icon'] != False %} + <a rel="license" + href="http://creativecommons.org/licenses/{{ CC_LICENSE['slug'] }}/{{ CC_LICENSE['version'] }}/" + target="_blank"> + <img alt="Creative Commons License" + title="Creative Commons License" + style="border-width:0" + {% if CC_LICENSE['local_icons'] %} + src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/cc/{{ CC_LICENSE['slug'] }}.png" + {% else %} + src="https://i.creativecommons.org/l/{{ CC_LICENSE['slug'] }}/{{ CC_LICENSE['version'] }}/80x15.png" + {% endif %} + width="80" + height="15"/> + </a> + {% endif %} + {% if STATUSCAKE %} + {% include "partial/statuscake.html" %} + {% endif %} +</p> diff --git a/theme/bulma/templates/partial/copyright.html b/theme/bulma/templates/partial/copyright.html new file mode 100644 index 0000000..9fecc4e --- /dev/null +++ b/theme/bulma/templates/partial/copyright.html @@ -0,0 +1,10 @@ +<p>© {{ COPYRIGHT_YEAR }} {{ COPYRIGHT_NAME }}</p> +<p> +{{ + _('Built with %(pelican_url)s', + pelican_url='<a href="http://getpelican.com" target="_blank">Pelican</a>') +}} +</p> +{% if STATUSCAKE %} + {% include "partial/statuscake.html" %} +{% endif %} diff --git a/theme/bulma/templates/partial/footer.html b/theme/bulma/templates/partial/footer.html new file mode 100644 index 0000000..8a2309c --- /dev/null +++ b/theme/bulma/templates/partial/footer.html @@ -0,0 +1,7 @@ +<footer class="has-text-centered is-size-6"> + {% if CC_LICENSE %} + {% include "partial/cc_license.html" %} + {% else %} + {% include "partial/copyright.html" %} + {% endif %} +</footer> diff --git a/theme/bulma/templates/partial/nav.html b/theme/bulma/templates/partial/nav.html new file mode 100644 index 0000000..a037522 --- /dev/null +++ b/theme/bulma/templates/partial/nav.html @@ -0,0 +1,17 @@ +{% if MAIN_MENU %} +<nav class="column is-3"> + <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 %} diff --git a/theme/bulma/templates/partial/pagination.html b/theme/bulma/templates/partial/pagination.html new file mode 100644 index 0000000..05dfc8c --- /dev/null +++ b/theme/bulma/templates/partial/pagination.html @@ -0,0 +1,14 @@ +{% if DEFAULT_PAGINATION %} + <div class="pagination mt-6"> + {% if articles_page.has_next() %} + <a class="pagination-previous" href="{{ SITEURL }}/{{ articles_next_page.url }}"> + <i class="fa fa-angle-left"></i> {{ _('Older Posts') }} + </a> + {% endif %} + {% if articles_page.has_previous() %} + <a class="pagination-next" href="{{ SITEURL }}/{{ articles_previous_page.url }}"> + {{ _('Newer Posts') }} <i class="fa fa-angle-right"></i> + </a> + {% endif %} + </div> +{% endif %} diff --git a/theme/bulma/templates/partial/sidebar.html b/theme/bulma/templates/partial/sidebar.html new file mode 100644 index 0000000..75ebaf1 --- /dev/null +++ b/theme/bulma/templates/partial/sidebar.html @@ -0,0 +1,78 @@ +<aside> + <div> + <a href="{{ SITEURL }}/"> + {% if SITELOGO %} + <img src="{{ SITELOGO }}" alt="{{ SITETITLE }}" title="{{ SITETITLE }}"> + {% else %} + <img src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.webp" alt="{{ SITETITLE }}" title="{{ SITETITLE }}"> + {% endif %} + </a> + + <div> + <p class="title is-1"> + <a href="{{ SITEURL }}/">{{ SITETITLE }}</a> + </p> + {% if SITESUBTITLE %} + <p class="subtitle">{{ SITESUBTITLE }}</p> + {% endif %} + </div> + + {% if (pages and DISPLAY_PAGES_ON_MENU) or LINKS %} + <nav class="content"> + <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 %} + {% set solid = ['at', 'envelope', 'mailbox', 'rss'] %} + {% set relme = ['at', 'envelope', 'mailbox', 'mastodon'] %} + <ul class="social"> + {% for name, link in SOCIAL %} + <li> + <a class="sc-{{ name }}" + {% if name in relme %}rel="me"{% endif %} + href="{{ link }}" + target="_blank"> + <i class="{% if name in solid %}fa-solid{% else %}fa{% endif %} fa-{{ name }}"></i> + </a> + </li> + {% endfor %} + </ul> + {% endif %} + + <button class="button is-ghost is-medium theme-switch"><i class="fa fa-adjust" aria-hidden="true" onclick="modeSwitcher()"></i></button> + </div> + +</aside> diff --git a/theme/bulma/templates/partial/translations.html b/theme/bulma/templates/partial/translations.html new file mode 100644 index 0000000..9c5e4fd --- /dev/null +++ b/theme/bulma/templates/partial/translations.html @@ -0,0 +1,10 @@ +{% macro translations_for(article) %} + {% if article.translations %} + <div class="translations"> + <a class="active" href="{{ SITEURL }}/{{ article.url }}">{{article.lang}}</a> + {% for translation in article.translations %} + <a href="{{ SITEURL }}/{{ translation.url }}">{{ translation.lang }}</a> + {% endfor %} + </div> + {% endif %} +{% endmacro %} |