Code Monkey home page Code Monkey logo

grav-theme-tail's Introduction

Tail Theme for Grav

Inspired by grav theme cacti and julian.com

Features

  • Lightweight and minimal for optimal performance
  • Made with tailwindcss
  • Fully responsive
  • Multiple page template types
  • Matomo-Support

Supported Page Templates

  • Default view template default.md
  • Error view template error.md
  • Blog view template post-list.md
  • Blog item view template post.md

There are templates for books. Books are currently a work in progress:

  • Book view template book-list.md
  • Book item view template book.md

Supported Plugins

The following plugins have custom styling by this theme:

See the Optional Plugins section for details and sample config snippets.

Installation

Installing the Tail theme can be done in one of two ways. Our GPM (Grav Package Manager) installation method enables you to quickly and easily install the theme with a simple terminal command, while the manual method enables you to do so via a zip file.

The theme by itself is useful, but you may have an easier time getting up and running by installing a skeleton. The Tail theme can be found in both the One-page and Blog Site which are self-contained repositories for a complete sites which include: sample content, configuration, theme, and plugins.

GPM Installation (Preferred)

The simplest way to install this theme is via the Grav Package Manager (GPM) through your system's Terminal (also called the command line). From the root of your Grav install type:

bin/gpm install tail

This will install the Tail theme into your /user/themes directory within Grav. Its files can be found under /your/site/grav/user/themes/tail.

Manual Installation

To install this theme, just download the zip version of this repository and unzip it under /your/site/grav/user/themes. Then, rename the folder to tail. You can find these files either on GitHub or via GetGrav.org.

You should now have all the theme files under

/your/site/grav/user/themes/tail

Site options

Footer

The footer links can be adapted in your site.yaml like this:

footer:
  links:
    - text: Terms
      url: '/datenschutz'
    - text: Conditions
      url: '/impressum'
  social:
    - icon: gitlab
      url: https://gitlab.com/marcelkr
    - icon: github
      url: https://gitlab.com/marcelkr

To use the social links with icons install grav-plugin-embed-fontawesome and follow the steps to set up the SVG files needed.

Matomo

Matomo is also configured via site.yaml. This is how a sample configuration:

matomo:
    enabled: true
    matomo_url: matomo.mysite.de
    site_id: 1

Once enabled, the partial partials/matomo.html.twig is included in the base template. matomo_url denotes the matomo URL. site_id configures the site ID used in Matomo. If you have several sites configured it might be != 1.

Style customizing

Most of the style can be customized by adapting the class attributes in the templates. This is the idea of tailwindcss's Utility-First Approach.

Important: The final css file is cleaned up with postcss-purgecss and minified by cssnano. Meaning: postcss-purgecss looks through your twig template files, recognizes which classes you used and then deletes all unused CSS from the final stylesheet. Then the sylesheet is minified using cssnano.

In case you're trying to add classes to the templates and nothing changes, it is possible that these classes aren't used anywhere else and therefore not present in the cleaned main.css. See Workflow on how to generate the stylesheet.

Workflow

  • Change to the themes/tail directory
  • Install the dependencies: npm install
  • Generate the stylesheet:
    • For development: npm run compile
    • For production: NODE_ENV=production npm run compile

In the development mode, main.css is not cleaned up. All of tailwinds classes can be used. In production mode, main.css is cleaned and minified.

If you want to adapt how tailwind is generated, have a look at tailwind.config.js. If you want to adapt how postcss works, look at postcss.config.js.

Optional Plugins

Markdown-Notices

The Markdown-Notices Plugin is supported and has custom styling. I suggest the following custom configuration for the plugin:

enabled: true
built_in_css: false
level_classes: [indigo, green, yellow, red]

Note level_classes being reordered and blue being replaced by indigo.

Pagination

Pagination works out of the box and needs no further configuration.

Langswitcher

The language switching template is included in the navbar as soon as the plugin Langswitcher is enabled and more than one language is available in the languages.supported array in the system.yaml config file.

For the exact behaviour and tweaking see partials/langswitcher.html.twig

grav-theme-tail's People

Stargazers

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

Watchers

 avatar

grav-theme-tail's Issues

metadata.html.twig

Hello

where is this file metadata.html.twig ?

we can read in base.html.twig

{% include 'partials/metadata.html.twig' %}

@+

blueprints.yaml

footer and matomo

instead of people adding all this you said to site.yaml
you could add it to blueprint.yaml of theme

that would make it easier for people

(just dont forget to change gitlab link to github, coz you have it twice)

How do I use the templates?

Hello,

I'm sure its just a stupid mistake from my end but I can't seem te recreate the example image.

I've installed and activated your plugin and created this:
image

I've added a title and content to the post.
image

Why does the main event page stays empty?

Add pagination

When the pagination plugin is installed, add pagination on collection pages.

Markdown will not be processed

Hey there. Thanks for that beautiful theme.

When using the Blog page (template set als post-list) and adding a sub-page as post, the outcome will not be rendered as markdown.
I have seen this issue came up before, but I checked the version and also all my settings. I am not sure, what particularly I am doing wrong.
Bildschirmfoto 2021-07-26 um 20 39 19
Bildschirmfoto 2021-07-26 um 20 39 27
Bildschirmfoto 2021-07-26 um 20 39 33

unsure whats the logic behind this

Instead of having

        `<a href="{{ home_url }}">{{ site.title }}</a>`

you put

        `<a href="{{ home_url }}">{{ site.author.name }}</a>`

this works for your site, I guess, but not really for others.

I mean, I'm unsure what stops you from renaming your site title to your own name.
That would be simpler than other people having to change code or having site name as site.author.name which makes little sense.

tailwind 3

could you update theme with tailwind 3?

Default template is not processing markdown

Hi,
If I use the default template with this code:

{% extends 'partials/base.html.twig' %}

{% block content %}
<article class="max-w-xl mx-auto">
    <header>
        <h1>{{ page.header.title }}</h1>
    </header>

            {{ page.content }}
    </article>
{% endblock %}

Markdown is not processing.
If I put {{page.content}} inside <section class=prose> like in the post template then the markdown works.

I'm doing something wrong ? or is a not defined css for default.html.twig and is for this that markdown is not processed?

Thanks!

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.