Refactor content structure

This commit is contained in:
carpetscheme 2020-04-14 20:42:35 +02:00
parent 006d2691fd
commit 376c660a8e
14 changed files with 50 additions and 92 deletions

View file

@ -5,8 +5,7 @@ An insanely fast and performance-based Zola theme, ported from [Light Speed Jeky
Some fun facts about the theme: Some fun facts about the theme:
* Perfect score on Google's Lighthouse audit * Perfect score on Google's Lighthouse audit
* Only ~434 bytes of CSS * Only ~600 bytes of CSS
* No media queries
* No JavaScript * No JavaScript
Demo: [quirky-perlman-34d0da.netlify.com](https://quirky-perlman-34d0da.netlify.com) Demo: [quirky-perlman-34d0da.netlify.com](https://quirky-perlman-34d0da.netlify.com)
@ -19,8 +18,8 @@ Demo: [quirky-perlman-34d0da.netlify.com](https://quirky-perlman-34d0da.netlify.
- [Options](#options) - [Options](#options)
- [Title](#title) - [Title](#title)
- [Sass](#Sass) - [Sass](#Sass)
- [RSS](#RSS)
- [Footer menu](#footer-menu) - [Footer menu](#footer-menu)
- [Netlify](#netlify)
- [Original](#original) - [Original](#original)
- [License](#license) - [License](#license)
@ -37,12 +36,12 @@ and then enable it in your `config.toml`:
theme = "lightspeed" theme = "lightspeed"
``` ```
Posts should be placed in the `blog` folder. Posts should be placed directly in the `content` folder.
## Options ## Options
### Title ### Title
Set a tile and description for your site to appear in the header: Set a title and description in the config to appear in the site header:
```toml ```toml
title = "Different strokes" title = "Different strokes"
@ -52,7 +51,7 @@ description = "for different folks"
### Sass ### Sass
The theme's css is compiled from sass and the output is imported inline to the header :zap: Styles are compiled from sass and imported inline to the header :zap:
You can overide the styles by enabling sass compilation in the config: You can overide the styles by enabling sass compilation in the config:
@ -60,23 +59,7 @@ You can overide the styles by enabling sass compilation in the config:
compile_sass = true compile_sass = true
``` ```
...and placing a replacement `style.scss` file in the sass folder. ...and placing a replacement `style.scss` file in your sass folder.
### RSS
Enable rss with the standard zola option:
```toml
generate_rss = true
```
...and include your name and email in the feed by setting fields in `extra` with keys `author` and `email`:
```toml
[extra]
author = "Grant Green"
email = "grant@green.org"
```
### Footer-menu ### Footer-menu
Set a field in `extra` with a key of `footer_links`: Set a field in `extra` with a key of `footer_links`:
@ -94,6 +77,22 @@ footer_links = [
If you put `$BASE_URL` in a url, it will automatically be replaced by the actual If you put `$BASE_URL` in a url, it will automatically be replaced by the actual
site URL. site URL.
Create pages such as `$BASE_URL/about` by placing them in a subfolder of the content directory, and specifying the path in the frontmatter:
```toml
path = "about"
```
### Netlify
Deployed on netlify? Let people know in the footer by setting `netlify` in `extra` as `true`.
```toml
[extra]
netlify = true
```
## Original ## Original
This template is based on the Jekyll template [Light Speed Jekyll](https://github.com/bradleytaunt/lightspeed) by **Bradley Taunt**: This template is based on the Jekyll template [Light Speed Jekyll](https://github.com/bradleytaunt/lightspeed) by **Bradley Taunt**:

View file

@ -1,16 +1,16 @@
base_url = "https://quirky-perlman-34d0da.netlify.com" base_url = "https://quirky-perlman-34d0da.netlify.com"
title = "Light Speed" title = "Light Speed"
description = "Zola theme with a perfect Lighthouse score" description = "Zola theme with a perfect Lighthouse score"
compile_sass = true compile_sass = true
generate_rss = true generate_rss = true
highlight_code = true highlight_code = true
highlight_theme = "gruvbox-light" highlight_theme = "gruvbox-light"
[extra] [extra]
author = "Grant"
email = "Green" netlify = true
footer_links = [ footer_links = [
{url = "$BASE_URL/about", name = "About"}, {url = "$BASE_URL/about", name = "About"},

3
content/_index.md Normal file
View file

@ -0,0 +1,3 @@
+++
sort_by = "date"
+++

View file

@ -1,15 +1,14 @@
+++ +++
title = "About This Theme" title = "About This Theme"
template = "about.html" path = "about"
+++ +++
Some fun facts about the theme include: Some fun facts about the theme include:
* Perfect score on Google's Lighthouse audit * Perfect score on Google's Lighthouse audit
* Only ~434 bytes of CSS * Only ~600 bytes of CSS
* No media queries
* No JavaScript * No JavaScript
* Probably the fastest Jekyll theme on the Internet <sup>1</sup> * Probably the fastest Zola theme on the Internet <sup>1</sup>
## Who Made This ## Who Made This

View file

@ -1,11 +0,0 @@
{% extends "index.html" %}
{% block title %}{{ page.title }} &middot; {{ config.title }}{% endblock title %}
{% block description %}{{ page.description | default(value=config.description) }}{% endblock description %}
{% block content %}
<article>
<h1>{{ page.title }}</h1>
{{ page.content | safe }}
</article>
{% endblock content %}

View file

@ -9,7 +9,8 @@
<title>{% block title %}{{ config.title }} &middot; {{ config.description }}{% endblock title %}</title> <title>{% block title %}{{ config.title }} &middot; {{ config.description }}{% endblock title %}</title>
<meta name="description" content="{% block description %}{{ config.description }}{% endblock description %}" /> <meta name="description" content="{% block description %}{{ config.description }}{% endblock description %}" />
<meta name="author" content="{{ config.extra.author }}"> <!-- todo author name -->
<meta name="author" content="">
<link rel="shortcut icon" href="{{ get_url(path="favicon.ico") | safe }}" /> <link rel="shortcut icon" href="{{ get_url(path="favicon.ico") | safe }}" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}"> <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}">
@ -34,9 +35,8 @@
{% block content %} {% block content %}
<ul class="homepage-list" style="list-style:none;padding:1rem 0;"> <ul class="homepage-list" style="list-style:none;padding:1rem 0;">
{% set blog = get_section(path="blog/_index.md") %} {% for post in section.pages %}
{% for post in blog.pages | reverse %} {{ macros::post_in_list(post=post) }}
{{ macros::post_in_list(post=post) }}
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock content %} {% endblock content %}
@ -53,8 +53,9 @@
{% endfor %} {% endfor %}
</nav> </nav>
<small> <small>
Built with <a href="https://www.getzola.org/">Zola</a> & hosted on Built with <a href="https://www.getzola.org/">Zola</a>
<a href="https://netlify.com">Netlify</a>.<br /> {% if config.extra.netlify %} & hosted on <a href="https://netlify.com">Netlify</a>{% endif %}
.<br />
Maintained with &hearts; for the web. Maintained with &hearts; for the web.
</small> </small>
</footer> </footer>

View file

@ -1,11 +1,7 @@
{% macro post_in_list(post) %} {% macro post_in_list(post) %}
<li <li style="align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:10px;">
style="align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between;margin-bottom:10px;" <a href="{{ post.permalink | safe }}">{{ post.title }}</a>
> <time style="font-size:90%;" datetime="{{ post.date | date(format="%+") }}">{{ post.date | date(format="%B %d, %Y") }}</time>
<a href="{{ post.permalink | safe }}">{{ post.title }}</a> </li>
<time style="font-size:90%;" datetime="{{ post.date | date(format="%+") }}"
>{{ post.date | date(format="%B %d, %Y") }}</time
>
</li>
{% endmacro post_in_list %} {% endmacro post_in_list %}

View file

@ -4,8 +4,13 @@
{% block description %}{{ page.description | default(value=config.description) }}{% endblock description %} {% block description %}{{ page.description | default(value=config.description) }}{% endblock description %}
{% block content %} {% block content %}
<h1>{{ page.title }}</h1> <article>
<p style="font-size:90%;">Posted on <time datetime="{{ page.date | date(format="%+") }}">{{ page.date | date(format="%B %d, %Y") }}</time></p> <h1>{{ page.title }}</h1>
{{ page.content | safe }} {% if page.date %}
<p style="font-size:90%;">Posted on <time datetime="{{ page.date | date(format="%+") }}">{{ page.date | date(format="%B %d, %Y") }}</time></p>
{% endif %}
{{ page.content | safe }}
</article>
{% endblock content %} {% endblock content %}

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>{{ config.title }}</title>
<link>{{ config.base_url | escape_xml | safe }}</link>
<description>{{ config.description }}</description>
<generator>Zola</generator>
<language>{{ config.default_language }}</language>
<atom:link href="{{ feed_url | safe }}" rel="self" type="application/rss+xml"/>
<lastBuildDate>{{ last_build_date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
<author>
<name>{{ config.extra.author }}</name>
<email>{{ config.extra.email }}</email>
</author>
{% set blog = get_section(path="blog/_index.md") %}
{% for page in blog.pages | reverse %}
<item>
<title>{{ page.title }}</title>
<pubDate>{{ page.date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
<link>{{ page.permalink | escape_xml | safe }}</link>
<guid>{{ page.permalink | escape_xml | safe }}</guid>
<description>{% if page.summary %}{{ page.summary }}{% else %}{{ page.content }}{% endif %}</description>
</item>
{% endfor %}
</channel>
</rss>

View file

@ -14,11 +14,3 @@ author = "Bradley Taunt"
homepage = "https://github.com/bradleytaunt" homepage = "https://github.com/bradleytaunt"
repo = "https://github.com/bradleytaunt/lightspeed" repo = "https://github.com/bradleytaunt/lightspeed"
[extra]
author = ""
email = ""
footer_links = [
{url = "$BASE_URL/about", name = "About"},
]