Giter VIP home page Giter VIP logo

zola-theme-terminimal's Introduction

Terminimal

Build Status No JavaScript

Screenshot

See the live demo (of the default configuration) here: https://pawroman.github.io/zola-theme-terminimal/

Tested with Zola v0.17.2. Please note that earlier versions might not work because of breaking changes across Zola versions.

Fork disclaimer

This theme is a fork (not a port) of "Terminal" Hugo theme by Radosław Kozieł (aka. panr): https://github.com/panr/hugo-theme-terminal

Many thanks for that outstanding original theme, Radek!

For more information about this fork and the differences to the original theme, please see: Changes compared to the original theme below.

Versioning

This theme used to be non-versioned, e.g. you'd pull the master branch, and occasionally new features or fixes would be released.

Starting from version v1.0.0, the project adopted Semantic Versioning.

Please check the GitHub releases to see a change log and work out if there's any breaking changes.

How to start

Option A: clone the theme directly into your Zola site folder:

$ git clone https://github.com/pawroman/zola-theme-terminimal.git themes/terminimal

Option B: include it as a git submodule (it's better if you plan to use CI builders):

$ git submodule add https://github.com/pawroman/zola-theme-terminimal.git themes/terminimal

Then in your config.toml set:

theme = "terminimal"

# Sass compilation is required
compile_sass = true

Also see the Zola documentation on using themes: https://www.getzola.org/documentation/themes/installing-and-using-themes/

Shortcodes

The theme adds two custom shortcodes related to image handling.

image

Used to show images.

Required arguments:

  • src

Optional arguments:

  • alt
  • position (center [default] | left | right)
  • style

Example:

{{ image(src="/img/hello.png", alt="Hello Friend",
         position="left", style="border-radius: 8px;") }}

figure

Same as image, but with a few extra optional arguments:

  • caption (supports markdown)
  • caption_position (center [default] | left | right)
  • caption_style

Example:

{{ figure(src="http://rustacean.net/assets/rustacean-flat-gesture.png",
          style="width: 25%;",
          position="right",
          caption_position="left",
          caption="**Ferris**, the (unofficial) Rust mascot",
          caption_style="font-style: italic;") }}

OpenGraph

To add an image to a post, set the og_image extra option to the desired image in the same directory of the markdown file:

[extra]
og_image = "colocated_image.png"

Additionally, for the section pages and for posts to have a fallback image, add default_og_image to the [extra] section:

[extra]
default_og_image = "static/ocean.jpg"

Configuration

Only show the post's description

On each post you can specify the following:

description = "test description"

[extra]
show_only_description = true

This will render test description under this particular post on the homepage instead of a summary.

Colors

Both the accent colors and background colors are configurable.

By default, both accent and background are set to blue.

To configure menu, add this in [extra] section of your config.toml:

[extra]

# One of: blue, green, orange, pink, red.
# Defaults to blue.
# Append -light for light themes, e.g. blue-light
# Or append -auto, e.g. blue-auto
accent_color = "green"

# One of: blue, dark, green, orange, pink, red, light, auto
# Enabling dark background will also modify primary font color to be darker.
# Defaults to accent color (or, if not accent color specified, to blue).
background_color = "dark"

Logo text and link

You can set the "logo" text and what it links to, by modifying config.toml like so:

[extra]

# The logo text - defaults to "Terminimal theme"
logo_text = "My blog"

# The logo link - defaults to base_url.
logo_home_link = "/take/me/away!"

Author and copyright

You can set the footer's copyright author name like this:

[extra]

# Author name: when specified, modifies the default
# copyright text. Apart from author, it will
# contain current year and a link to the theme.
author = "My Name"

If you don't like the default copyright text, you can set it to completely custom HTML:

[extra]

# Copyright text in HTML format. If specified,
# entirely replaces default copyright and author.
copyright_html = "My custom&nbsp;<b>copyright</b>"

Menu

The menu is optional, static (all items are always shown, no matter what the screen size) and fully user-configurable.

To configure menu, add this in [extra] section of your config.toml:

[extra]

# menu is enabled by adding menu_items (optional)
menu_items = [
    # each of these is optional, name and url are required
    # $BASE_URL is going to be substituted by base_url from configuration
    {name = "blog", url = "$BASE_URL"},
    
    # tags should only be enabled if you have "tags" taxonomy
    # see documentation below for more details
    {name = "tags", url = "$BASE_URL/tags"},
    {name = "archive", url = "$BASE_URL/archive"},
    {name = "about me", url = "$BASE_URL/about"},
    
    # set newtab to true to make the link open in new tab
    {name = "github", url = "url-to-your-github", newtab = true},
]

Tags

The theme optionally supports tags. To enable them, create a "tags" taxonomy in your config.toml:

taxonomies = [
    {name = "tags"},
]

Enabling tags will create a new /tags page, and cause them to show up in archive section. Note that you still need to create a menu link to the tags page manually.

Pagination

Pagination is fully supported for post list (main site) and intra-post (you can navigate to earlier and later posts).

To make sure pagination works properly, you must first configure it in content/_index.md:

+++
# number of pages to paginate by
paginate_by = 2

# sorting order for pagination
sort_by = "date"
+++

Then, tweak the theme's pagination config in config.toml:

[extra]

# Whether to show links to earlier and later posts
# on each post page (defaults to true).
enable_post_view_navigation = true

# The text shown at the bottom of a post,
# before earlier/later post links.
# Defaults to "Thanks for reading! Read other posts?"
post_view_navigation_prompt = "Read more"

Language code

Internationalization / translation is not supported but you can set the HTML language code for your site:

default_language = "en"

Hack font subset

By default, the theme uses a mixed subset of the Hack font. Normal weight font uses full character set (for Unicode icons and special symbols), but all others (bold, italic etc) use a limited subset.

This results in much smaller transfer sizes, but the subset might not contain all the Unicode characters you need.

You can enable full unicode support in config.toml:

[extra]

# Use full Hack character set, not just a subset.
# Switch this to true if you need full unicode support.
# Defaults to false.
use_full_hack_font = true

Also see Hack's docs.

Favicon

The theme supports adding a global favicon (applies to all pages) to the site:

# Optional: Global favicon URL and mimetype.
#           Mimetype defaults to "image/x-icon".
#           The URL should point at a file located
#           in your site's "static" directory.
favicon = "/favicon.png"
favicon_mimetype = "image/png"

Page titles

The theme allows you to configure how the page titles (the <title> elements) are rendered.

Use "combined" to render titles as "Page title | Main title".

# Optional: Set how <title> elements are rendered.
# Values:
# - "main_only" -- only the main title (`config.title`) is rendered.
# - "page_only" -- only the page title (if defined) is rendered,
#                  falling back to `config.title` if not defined or empty.
# - "combined" -- combine like so: "page_title | main_title",
#                 or if page_title is not defined or empty, fall back to `main_title`
#
# Note that the main (index) page only has the main title.
page_titles = "combined"

All the configuration options are also described in config.toml.

Extending

Each of the templates defines named blocks, so it should be quite easy to customize the most common things.

For example, if you want to add extra <meta> tags to the base template, index.html, create file like this in templates/index.html:

{% extends "terminimal/templates/index.html" %}

{% block extra_head %}
    <meta name="description" content="My awesome website"/>
    <meta name="keywords" content="Hacking,Programming,Ranting"/>
{% endblock %}

How to contribute

If you spot any bugs or wish to contribute new features, please create a new Pull Request.

Changes compared to the original theme

This theme has been forked from https://github.com/panr/hugo-theme-terminal

  • Slight changes in the layout and styling.

    • Content has been centered (instead of left-aligned).
    • The header stripes have been spaced out.
    • Tweaks to pagination, especially on mobile (small screens).
    • The post title underline is dashed instead of doubly-dotted.
    • All links are underlined, as per Brutalist Web Design Guidelines.
    • Tweaks to header font sizes.
    • Minor footer tweaks.
  • Absolutely no JavaScript.

    • No JavaScript needed to pre-process anything. Zola with its Sass pre-processor is the only dependency.
    • There's no menu trigger.
    • Things load crazy fast, as it's all static content.
    • Prism.js syntax highlighting is not supported (you can use Zola's).
  • All references to social media (e.g. Twitter) have been removed.

  • All references to external URLs (e.g. Google CDN) have been removed. This theme's static assets are meant to be served from where it's hosted.

  • Hack is the default font.

  • The default color theme is blue (original uses orange).

New features

  • You can pick the accent color as well as background color. There's a new dark background. See Configuration below for details.
  • Active "section" links will change color indicating the active section. This is all static, done at template level.

Features retained from the original

  • 5 color themes, depending on your preference: blue (default), green, orange, pink, red.
  • The shortcodes image and figure (See Shortcodes).
  • Fully responsive.

License

Copyright © 2019 Paweł Romanowski (pawroman)

Original theme: Copyright © 2019 Radosław Kozieł (@panr)

The theme is released under the MIT License. Check the license file for more information.

The license for Hack fonts used is included in LICENSE-Hack.md.

zola-theme-terminimal's People

Contributors

antoniosbarotsis avatar djanda97 avatar dym-sh avatar goingforbrooke avatar heitorpb avatar ipetkov avatar lynnpepin avatar pablogamboa avatar pawroman avatar urlordjames avatar vloupmon avatar wafflelapkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zola-theme-terminimal's Issues

Post view navigation broken in zola 0.16

The post view navigation HTML isn't injected into posts in zola 0.16, but it works with the same config in 0.15.3.

I haven't bisected zola yet but it should be pretty easy to find. I'm also not sure if this is a theme regression or a potential zola regression.

Support ATOM feeds

Currently, the theme hardcodes the path to the RSS feed (if it exists), which can be an issue if you use ATOM instead.

RSS feeds are usually named rss.xml while ATOM ones are atom.xml, but could be anything else.

I have a backwards-compatible change to template/index.html that works for both types of feed in #35, is this something that the project is interested in?

Variable 'config.extra.page_titles' not found in context while rendering 'macros/title.html'

Hello,

I'm interested in using this theme for my blog but I ran into an issue during setup. I successfully added the theme via the git submodule add https://github.com/pawroman/zola-theme-terminimal.git themes/terminimal command and added the theme = "terminimal" value to my config.toml file. The issue that I encountered occurred when trying to run zola serve:

image

For reference, this is the content of the content/_index.md file, showing that the template and page_template values are set to their respective files under the terminimal/templates/ directory:

image

In the themes/terminimal/config.toml file there is a default value for the page_titles variable, however it seems that it is not being recognized. I found a workaround in order for the site to be successfully served by setting page_titles = "combined" under the [extra] section in my config.toml file, but I'm not sure if it is the indented behavior for a user to be required to set this value.

Thanks,
David

Fail to build when the first menu item is different than $BASE_URL

If the URL of the first menu item in config.toml is not $BASE_URL, then the build will fail.

For example, this builds :

menu_items = [
    {name = "test", url = "$BASE_URL"},
]

This doesn't build :

menu_items = [
    {name = "test", url = "http://test.test"},
]

It can be worked around with a nameless menu entry :

menu_items = [
    {name = "", url = "$BASE_URL"},
]

code blocks should scroll horizontally if they exceed the content width

Code blocks with long lines cause the entire page to overflow/scroll horizontally, which looks really bad:

2022-01-27-144708_grim

This is what I'd expect to happen in these situations:

2022-01-27-144449_grim

I couldnt' get this to work by setting overflow-x:scroll in the pre CSS, but I did get it to work when I wrapped the <pre> in a <div style="overflow-x:scroll">

Is it possible to overwrite the font?

I have currently added the following in my own scss file:

* {
  font-family: '...' !important;
}

Which works fine, but, the hack font is still downloaded, wasting some amount of time on the initial page load. Is that something I could change without making changes to the theme's code itself?

Edit: I realize that this might be more of a zola question than a theme question but I couldn't find anything in the docs so I'm just asking here for now.

Add website source as a footer setting

I'd like to add a link to the source repo of the website; the footer seems like the perfect place. This could be implemented as a config.extra.website_source setting that would add sth like "This website is open-source".

Config option for disabling post summaries?

Hello!
I'm interested in disabling the post summaries that are displayed on the home page (using terminimal/templates/index.html). Note: I am using the terminimal theme as a git submodule.

Initially, I tried making the following change to this line https://github.com/pawroman/zola-theme-terminimal/blob/master/templates/index.html#L74.

From: {{ post_macros::content(page=page, summary=true) }}
To: {{ post_macros::content(page=page, summary=false) }}

After setting the summary parameter to false, the summaries were still being displayed (this might be a bug?)
In addition to editing the terminimal/templates/index.html file directly, I also tried extending the template and editing the summary parameter in the custom/extended template to no avail.

The ability to enable or disable post summaries seems like a great feature to add as a configuration option.
I could help implement this feature, but I am new to Zola and still learning how the Tera templating engine works, so any advice or recommendations would be appreciated 😄

Relative image URLs are broken

As reported by @ipetkov

Came across this while updating my site, turns out this change actually breaks relative image URLs 😬

Basically I am using {{ image(src="blah.jpg") }} since sometimes I organize posts in their own directory (where index.md and the photo are siblings under the same directory). Browsers will interpret the URL as being relative to the current URL, except now the URL is rewritten to http://127.0.0.1:1111/flower.png even though the actual image is located at http://127.0.0.1:1111/the_post/flower.png

Originally posted by @ipetkov in #37 (comment)

figures don't center

Figures with captions which are shorter than the width of the content div, even when position="center" is explicitly specified, are always aligned to the left.

I believe the issue is caused by:

&.left {
img {
margin-right: auto;
}
}
&.center {
img {
margin-left: auto;
margin-right: auto;
}
}
&.right {
img {
margin-left: auto;
}
}

These styles should apply to both the figure element and the nested img.

Use post title as page title

The <title> used on every single page is the one defined in the config file. I think the page title should be the same as the post title when viewing a specific post.

Does terminimal support RSS 2.0?

I don’t know how made rss feed. Because when I setup atom.xml it gives me feed in Atom format, and when I use rss.xml like in zola docs it just don’t work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.