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:
* Perfect score on Google's Lighthouse audit
* Only ~434 bytes of CSS
* No media queries
* Only ~600 bytes of CSS
* No JavaScript
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)
- [Title](#title)
- [Sass](#Sass)
- [RSS](#RSS)
- [Footer menu](#footer-menu)
- [Netlify](#netlify)
- [Original](#original)
- [License](#license)
@ -37,12 +36,12 @@ and then enable it in your `config.toml`:
theme = "lightspeed"
```
Posts should be placed in the `blog` folder.
Posts should be placed directly in the `content` folder.
## Options
### 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
title = "Different strokes"
@ -52,7 +51,7 @@ description = "for different folks"
### 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:
@ -60,23 +59,7 @@ You can overide the styles by enabling sass compilation in the config:
compile_sass = true
```
...and placing a replacement `style.scss` file in the 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"
```
...and placing a replacement `style.scss` file in your sass folder.
### Footer-menu
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
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
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"
title = "Light Speed"
description = "Zola theme with a perfect Lighthouse score"
compile_sass = true
generate_rss = true
highlight_code = true
highlight_theme = "gruvbox-light"
[extra]
author = "Grant"
email = "Green"
netlify = true
footer_links = [
{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"
template = "about.html"
path = "about"
+++
Some fun facts about the theme include:
* Perfect score on Google's Lighthouse audit
* Only ~434 bytes of CSS
* No media queries
* Only ~600 bytes of CSS
* 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

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

View file

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

View file

@ -4,8 +4,13 @@
{% block description %}{{ page.description | default(value=config.description) }}{% endblock description %}
{% block content %}
<article>
<h1>{{ page.title }}</h1>
{% 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 %}

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"
repo = "https://github.com/bradleytaunt/lightspeed"
[extra]
author = ""
email = ""
footer_links = [
{url = "$BASE_URL/about", name = "About"},
]