extra config option to allow users to select their own style
This commit is contained in:
parent
e5b09a5d60
commit
bb48d3da34
10 changed files with 153 additions and 61 deletions
|
@ -5,6 +5,7 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
{% block head %}
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
|
||||
|
@ -15,28 +16,27 @@
|
|||
{% block title %}{{ config.title }}{% endblock title %}
|
||||
</title>
|
||||
|
||||
{% if config.extra.zulma_theme %}
|
||||
<link rel="preload" as="style" href="{{ get_url(path=config.extra.zulma_theme ~ ".css", trailing_slash=false) }}" />
|
||||
{% else %}
|
||||
<link rel="preload" as="style" href="{{ get_url(path="default.css", trailing_slash=false) }}" />
|
||||
{% endif %}
|
||||
{% for theme in config.extra.zulma_themes %}
|
||||
<link rel="preload" as="style" href="{{ get_url(path=theme ~ ".css", trailing_slash=false) }}" />
|
||||
{% endfor %}
|
||||
|
||||
{% block css %}
|
||||
{{ index_macros::css() }}
|
||||
{% endblock css %}
|
||||
|
||||
{% if config.generate_rss %}
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}">
|
||||
{% endif %}
|
||||
|
||||
{% block css %}
|
||||
{% if config.extra.zulma_theme %}
|
||||
<link rel="stylesheet" href="{{ get_url(path=config.extra.zulma_theme ~ ".css", trailing_slash=false) }}" />
|
||||
{% else %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="default.css", trailing_slash=false) }}" />
|
||||
{% endif %}
|
||||
{% endblock css %}
|
||||
|
||||
{% block js %}
|
||||
{% if config.build_search_index %}
|
||||
<script defer type="text/javascript" src="{{ get_url(path="elasticlunr.min.js") }}"></script>
|
||||
<script defer type="text/javascript" src="{{ get_url(path="search_index.en.js") }}"></script>
|
||||
{% endif }
|
||||
{% if config.extra.zulma_allow_theme_selection %}
|
||||
<script type="text/javascript" src="{{ get_url(path="js/switchcss.js") }}"></script>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock js %}
|
||||
|
||||
{% block extra_head %}
|
||||
{% endblock extra_head %}
|
||||
|
@ -52,6 +52,7 @@
|
|||
}
|
||||
</style>
|
||||
</noscript>
|
||||
{% endblock head %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
@ -84,6 +85,8 @@
|
|||
</main>
|
||||
{% endblock content %}
|
||||
|
||||
{{ index_macros::footer() }}
|
||||
|
||||
<script type="text/javascript" src="{{ get_url(path="js/bulma.js") }}"></script>
|
||||
|
||||
{% if config.build_search_index %}
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
</a>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if config.build_search_index %}
|
||||
<div class="navbar-item search-container js-only">
|
||||
<input class="input is-primary" id="search" type="search" placeholder="Search">
|
||||
|
@ -91,4 +92,57 @@
|
|||
</nav>
|
||||
</header>
|
||||
{% endif %}
|
||||
{% endmacro navbar %}
|
||||
{% endmacro navbar %}
|
||||
|
||||
{% macro footer() %}
|
||||
{% if config.extra.zulma_allow_theme_selection %}
|
||||
<footer class="footer js-only">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="content">
|
||||
<div class="is-pulled-right">
|
||||
Theme:
|
||||
<select id="theme-select">
|
||||
{% for theme in config.extra.zulma_themes %}
|
||||
{% if config.extra.zulma_theme %}
|
||||
{% set default_theme = config.extra.zulma_theme %}
|
||||
{% else %}
|
||||
{% set default_theme = "default" %}
|
||||
{% endif %}
|
||||
{% if default_theme == theme %}
|
||||
<option selected="selected" value="{{ theme }}">{{ theme }}</option>
|
||||
{% else %}
|
||||
<option value="{{ theme }}">{{ theme }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{% endif %}
|
||||
{% endmacro footer %}
|
||||
|
||||
{% macro css() %}
|
||||
{% if config.extra.zulma_allow_theme_selection %}
|
||||
{% for theme in config.extra.zulma_themes %}
|
||||
{% if config.extra.zulma_theme %}
|
||||
{% set default_theme = config.extra.zulma_theme %}
|
||||
{% else %}
|
||||
{% set default_theme = "default" %}
|
||||
{% endif %}
|
||||
{% if default_theme == theme %}
|
||||
<link id="{{theme}}" class="stylesheet" rel="stylesheet"
|
||||
href="{{ get_url(path=theme ~ ".css", trailing_slash=false) }}" />
|
||||
{% else %}
|
||||
<link id="{{theme}}" class="stylesheet" media="none" rel="stylesheet"
|
||||
href="{{ get_url(path=theme ~ ".css", trailing_slash=false) }}" />
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% elif config.extra.zulma_theme %}
|
||||
<link rel="stylesheet" href="{{ get_url(path=config.extra.zulma_theme ~ ".css", trailing_slash=false) }}" />
|
||||
{% else %}
|
||||
<link rel="stylesheet" href="{{ get_url(path="default.css", trailing_slash=false) }}" />
|
||||
{% endif %}
|
||||
{% endmacro css %}
|
|
@ -46,19 +46,21 @@
|
|||
{% endmacro page_in_list %}
|
||||
|
||||
{% macro post_footer(page) %}
|
||||
<footer class="card-footer article-footer">
|
||||
<div class="columns is-multiline">
|
||||
<div class="column is-12">
|
||||
<p>
|
||||
Published
|
||||
{{self::post_footer_date(page=page)}}
|
||||
{{self::post_footer_authors(page=page)}}
|
||||
{{self::post_footer_categories(page=page)}}
|
||||
{{self::post_footer_tags(page=page)}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="column">
|
||||
<a class="button is-pulled-right is-info" href="/">Back Home</a>
|
||||
<footer class="card-footer">
|
||||
<div class="article-footer">
|
||||
<div class="columns is-multiline">
|
||||
<div class="column is-12">
|
||||
<p>
|
||||
Published
|
||||
{{self::post_footer_date(page=page)}}
|
||||
{{self::post_footer_authors(page=page)}}
|
||||
{{self::post_footer_categories(page=page)}}
|
||||
{{self::post_footer_tags(page=page)}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="column">
|
||||
<a class="button is-pulled-right is-info" href="/">Back Home</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue