taxonomy titles are now chosen programatically; footer is now always at the bottom; updated taxonomies and readme;

This commit is contained in:
Robert Clarke 2019-05-08 13:07:26 +01:00
parent 599a6f9af0
commit 0f57726bc4
12 changed files with 43 additions and 28 deletions

View file

@ -1,5 +1,7 @@
# Zulma # Zulma
A Bulma theme for Zola.
## Contents ## Contents
- [Zulma](#zulma) - [Zulma](#zulma)
@ -44,7 +46,7 @@ All the source javascript files live in `javascript/src`. This is a list of the
- `zulma_switchcss.js` - Used for swapping themes (if enabled). Created by me. - `zulma_switchcss.js` - Used for swapping themes (if enabled). Created by me.
### Building ### Building
These are transpiled by babel, minified by webpack, sourcemaps are generated and then everything placed in `static/js`. The repo already contains the transpiled and minified files along with their corrosponding sourcemaps so you don't need to do anything to use these. If you would prefer to build it yourself, feel free to inspect the js files and then run the build process yourself (please ensure that you have [node, npm](https://nodejs.org/en/) and [yarn](https://yarnpkg.com/lang/en/) installed.): The javascript files are transpiled by babel, minified by webpack, sourcemaps are generated and then everything placed in `static/js`. The repo already contains the transpiled and minified files along with their corrosponding sourcemaps so you don't need to do anything to use these. If you would prefer to build it yourself, feel free to inspect the js files and then run the build process yourself (please ensure that you have [node, npm](https://nodejs.org/en/) and optionally [yarn](https://yarnpkg.com/lang/en/) installed.):
``` ```
cd javascript cd javascript
@ -83,7 +85,7 @@ authors = ["Joe Bloggs"]
will cause that metadata to appear on the post, either on the header for the name, or at the bottom for tags and categories, and enable those pages. will cause that metadata to appear on the post, either on the header for the name, or at the bottom for tags and categories, and enable those pages.
Making your own taxonomies is also designed to be as easy as possible, however it does seem to require adding files directly to the theme (someone please let me know if this isn't the case!). First, add it to your cargo.tml Making your own taxonomies is also designed to be as easy as possible. First, add it to your cargo.tml
```toml ```toml
taxonomies = [ taxonomies = [
@ -91,26 +93,25 @@ taxonomies = [
] ]
``` ```
and make the corrosponding folder in the theme templates, in this case: `themes\zulma\templates\links`, and the necessary files: `themes\zulma\templates\links\list.html` and `themes\zulma\templates\links\single.html` and make the corrosponding folder in your templates, in this case: `templates\links`, and the necessary files: `templates\links\list.html` and `templates\links\single.html`
And then for each, just inherit the master page, render the block `content`, and set a variable called `title` for the hero to display on that page. And then for each, just inherit the zulma master page, render the block `content`. You may optionally set a variable called `title` for the hero to display on that page, otherwise it will use the default for that taxonomy.
In `list.html`: In `single.html`:
```handlebars ```handlebars
{% extends "taxonomy_list.html" %} {% extends "Zulma/templates/taxonomy_single.html" %}
{% block content %} {% block content %}
{% set title = "All Links"%}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}
``` ```
In `single.html`: In `list.html`:
```handlebars ```handlebars
{% extends "taxonomy_single.html" %} {% extends "Zulma/templates/taxonomy_list.html" %}
{% block content %} {% block content %}
{% set title = "Link: " ~ term.name %} {% set title = "These are all the Links"%}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}
``` ```

View file

@ -2,6 +2,13 @@ html,
body { body {
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
font-size: 14px; font-size: 14px;
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1;
} }
.navbar-brand .brand-text { .navbar-brand .brand-text {
@ -48,6 +55,7 @@ body {
.article-footer, .article-footer,
.article-body { .article-body {
margin: 2rem 0; margin: 2rem 0;
@include desktop { @include desktop {
margin: 2rem 6rem; margin: 2rem 6rem;
} }
@ -120,7 +128,8 @@ input#search::placeholder{
padding: 2rem; padding: 2rem;
} }
.pagination-previous, .pagination-next { .pagination-previous,
.pagination-next {
flex-grow: 0; flex-grow: 0;
} }

View file

@ -1,6 +1,5 @@
{% extends "taxonomy_list.html" %} {% extends "taxonomy_list.html" %}
{% block content %} {% block content %}
{% set title = "All Authors"%}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}

View file

@ -1,6 +1,5 @@
{% extends "taxonomy_single.html" %} {% extends "taxonomy_single.html" %}
{% block content %} {% block content %}
{% set title = "Author: " ~ term.name %}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}

View file

@ -1,6 +1,5 @@
{% extends "taxonomy_list.html" %} {% extends "taxonomy_list.html" %}
{% block content %} {% block content %}
{% set title = "All Categories"%}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}

View file

@ -1,6 +1,5 @@
{% extends "taxonomy_single.html" %} {% extends "taxonomy_single.html" %}
{% block content %} {% block content %}
{% set title = "Category: " ~ term.name %}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}

View file

@ -59,7 +59,7 @@
<main class="index"> <main class="index">
<!-- START HERO TITLE --> <!-- START HERO TITLE -->
{% if config.extra.zulma_title %} {% if config.extra.zulma_title %}
{{ index_macros::hero(title=config.extra.zulma_title) }} {{ index_macros::hero(title=config.extra.zulma_title, primary=true) }}
{% endif %} {% endif %}
<!-- END HERO TITLE --> <!-- END HERO TITLE -->
<div class="container"> <div class="container">

View file

@ -1,5 +1,9 @@
{% macro hero(title) %} {% macro hero(title, primary) %}
<section class="hero is-primary is-bold"> {% set class = "is-bold" %}
{% if primary %}
{% set class = class ~ " hero is-primary" %}
{% endif %}
<section class="{{class}}">
<header> <header>
<div class="hero-body"> <div class="hero-body">
<div class="container has-text-centered"> <div class="container has-text-centered">
@ -30,7 +34,8 @@
{% if paginator.previous %} {% if paginator.previous %}
<a class="button is-primary pagination-previous" href="{{ paginator.previous }}">&laquo; Previous</a> <a class="button is-primary pagination-previous" href="{{ paginator.previous }}">&laquo; Previous</a>
{% else %} {% else %}
<a class="button is-primary pagination-previous" disabled title="This is the first page">&laquo; Previous</a> <a class="button is-primary pagination-previous" disabled title="This is the first page">&laquo;
Previous</a>
{% endif %} {% endif %}
<ul class="pagination-list"> <ul class="pagination-list">
<li>Page {{ paginator.current_index }} of {{ paginator.number_pagers }}</li> <li>Page {{ paginator.current_index }} of {{ paginator.number_pagers }}</li>

View file

@ -1,6 +1,5 @@
{% extends "taxonomy_list.html" %} {% extends "taxonomy_list.html" %}
{% block content %} {% block content %}
{% set title = "All Tags"%}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}

View file

@ -1,6 +1,5 @@
{% extends "taxonomy_single.html" %} {% extends "taxonomy_single.html" %}
{% block content %} {% block content %}
{% set title = "Tag: " ~ term.name %}
{{ super() }} {{ super() }}
{% endblock content %} {% endblock content %}

View file

@ -10,7 +10,10 @@
<!-- END NAV --> <!-- END NAV -->
<main> <main>
<!-- START HERO TITLE --> <!-- START HERO TITLE -->
{{ index_macros::hero(title=title) }} {% if not title %}
{% set title = "All " ~ taxonomy.name | title %}
{% endif %}
{{ index_macros::hero(title=title,primary=false) }}
<!-- END HERO TITLE --> <!-- END HERO TITLE -->
<!-- START TAXONOMY LIST --> <!-- START TAXONOMY LIST -->
{{ taxonomy_macros::list(terms=terms) }} {{ taxonomy_macros::list(terms=terms) }}

View file

@ -11,7 +11,10 @@
<!-- END NAV --> <!-- END NAV -->
<main> <main>
<!-- START HERO TITLE --> <!-- START HERO TITLE -->
{{ index_macros::hero(title=title) }} {% if not title %}
{% set title = taxonomy.name ~ ": " ~ term.name | capitalize %}
{% endif %}
{{ index_macros::hero(title=title,primary=false) }}
<!-- END HERO TITLE --> <!-- END HERO TITLE -->
<div class="container"> <div class="container">
<!-- START ARTICLE FEED --> <!-- START ARTICLE FEED -->