/lste

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Lauras Simple Template Engine

LSTE (Laura's Simple Template Engine) is a minimalist static site generator designed to help you quickly create and manage small websites with ease. LSTE allows you to build a complete website by combining template parts, assets, and content, all while keeping the process straightforward and lightweight.

  • See /example-simple for a simple website template
  • See /example-full for a website template which uses several plugins (which basically is my blog)

Usage

Make sure you have python3 and python3-markdown installed.

  1. Clone this repository
  2. execute ./lste.py --path=./example-simple to generate a website into ./example-simple/dist
# NAME
#   Lauras Simple Template Enginge - LSTE
#
# SYNOPSIS
#   ./lste.py [--watch] [--path]
#
# DESCRIPTION
#   This script generates a website to ./dist out of the given template
#   parts, the assets and the content itself
#
# EXAMPLE:
#   ./lste.py --path=./website-src
#
# OPTIONS
#   -p|--path         Sets the base directory for the website. If not setted
#                     LSTE uses the current active directory
#   -w|--watch        Automatically generates the website to ./dist
#                     if a file in /src, /assets or /parts changed

Hint: You can also link the lste.py to your local bin directory to use it systemwide

Template Development

This guide should help to setup a simple LSTE project:

  1. Create a file lste.conf in an empty folder and fill it with some settings (see next chapter)
  2. Create the folders ./template, ./content and ./assets
  3. Place the actual content in ./content, like index.md or about.md. LSTE will generate index.html or about.html out of these files.
  4. Use the ./assets folder for you stylesheets, images etc.
  5. Insert your template parts in the ./template folder

Site Data

The basic site data is stored in the lste.conf. It must have following content:

[lste]
title = My LSTE Project
keywords = these, are, my, keywords
description = My very first LSTE project

These settings are the global settings and data of the project.

Template Parts

The template parts are simple HTML-files. LSTE needs two mandatory template files:

  • index.html
  • page.html

The code snippet {{part: my-template-part.html}} allocates my-template-part.html in the ./template folder and includes its content. See example-simple for an example.

Assets

LSTE has no further configuration for the assets folder. It simply copies all its content to the destination so you can use anything in there you want.

Other functions

There are built-in functions which display different kind of information

  • {{title}}: Renders the title
  • {{keywords}}: Renders the meta keywords
  • {{meta-description}}: Renders the meta description
  • {{timestamp}}: Renders a unix timestamp when the page was generated by LSTE

The --watch argument

You can start LSTE with the argument --watch (or -w). It automatically checks for modifications in the folders ./template, ./content, ./assets and the lste.conf file. If anything changes there or a file is added, the website will be generated automatically.

./lste.py --path=./example --watch

Starts the watcher for the ./example project.

Plugins

LSTE itself is very limited in its functionality but it comes with a plugin system which allows expanding everything in LSTE.

Currated Plugins

Currently there are following currated plugins available:

  • Meta allows the usage of meta fields throught an LSTE project
  • Active Menu which allows to indicate which menu entry should be active
  • Articles enables a blog like content management
  • Excerpts Markdown enables markdown rendering for excerpts
  • RSS generates an RSS-Feed out of the articles.

See the readmes on the plugins for more information about their functionality.

Using plugins

Using plugins in LSTE is fairly easy:

  1. Create a file in your home directory called .listerc
  2. Place the content for the plugins into it whereas the value is the shortened address of the plugin on github:
[plugins]
active-menu = lauratheq/active-menu.lste
meta = lauratheq/meta.lste
articles = lauratheq/articles.lste
excerpts-markdown = lauratheq/excerpts-markdown.lste
rss = lauratheq/rss.lste

And that's it. LSTE will download the plugins with the next page generation.

Contributing

Contributor Code of Conduct

Please note that this project is adapting the Contributor Code of Conduct from WordPress.org even though this is not a WordPress project. By participating in this project you agree to abide by its terms.

Basic Workflow

  • Grab an issue
  • Fork the project
  • Add a branch with the number of your issue
  • Develop your stuff
  • Commit to your forked project
  • Send a pull request to the main branch with all the details

Please make sure that you have set up your user name and email address for use with Git. Strings such as silly nick name <root@localhost> look really stupid in the commit history of a project.

Due to time constraints, you may not always get a quick response. Please do not take delays personally and feel free to remind.

Workflow Process

  • Every new issue gets the label 'Request'
  • Every commit must be linked to the issue with following pattern: #${ISSUENUMBER} - ${MESSAGE}
  • Every PR only contains one commit and one reference to a specific issue