Giter VIP home page Giter VIP logo

stasi-blog's Introduction

stasi-blog

A small generator for static and simple blogs.

Overview

Installation

If you don't want to use one of the release versions from the release section or there's no binary for your platform, you can easily build the project yourself.

All you need is a terminal and Golang 1.21 or later.

Installation via go

Run:

go install github.com/Bios-Marcel/stasi-blog@latest

In order to update, run the same command again.

The produced binary will be installed at $GOPATH/bin. If your GOPATH isn't set, the default location should be ~/go. On my machine, this would be /home/marcel/go/bin. For more information consult the official documentation.

In order to be able to run the tool via your terminal, you have to put ~/go/bin onto your PATH variable.

Building

The second option is to manually download the source code and execute the build command.

You can download the source code via the GitHub webpage or by using git, which you can get here or from your distributions package manager, if your system offers one.

In order to download via git, open a terminal and run:

git clone https://github.com/Bios-Marcel/stasi-blog.git

This downloads the source code to your current working directory.

To produce a self-contained binary, open your terminal, navigate to the directory where you downloaded the source code to and run:

go build .

This will produce a binary called stasi-blog or stasi-blog.exe if you are on Windows.

To test whether everything works, you can compile and run the example:

./stasi-blog build ./example --output="example-output"
./stasi-blog serve ./example-output

Then open localhost:8080 in your browser.

DO NOT USE THE DEMO SERVER IN PRODUCTION!

If you want to update your build, run git pull in the source code direcotry to get the latest changes and run go build . again.

Usage

There's an input and an output folder. Both of these can be specified via the respective parameters input and output.

As for the input folder structure, the following is expected:

input
|--media             <-- Images, Videos and such
|--pages             <-- Optional static pages
|  |--about.html     <-- Example page
|--articles          <-- Contains blog posts
|  |--post-one.html  <-- Example post
|--config.json       <-- Basic page information
|--favicon.ico/png   <-- Icon to show in browser; To disable, set "UseFavicon" to false

An example for the config.json:

{
   "BasePath": "",
   "SiteName":"My Blog",
   "Author":"Firstname Lastname",
   "URL":"https://github-handle.github.io",
   "Description":"something descriptive",
   "Email":"[email protected]",
   "CreationDate":"2018-05-27T00:00:00+00:00",
   "UtterancesRepo": "github-handle/github-handle.github.io",
   "MaxIndexEntries": 10,
   "AddOptionalMetaData": true,
   "DateFormat": "2 January 2006",
   "UseFavicon": true,
}

The following properties are optional:

  • BasePath (Needed if files aren't served at domain-root)
  • Author (Used for metadata/RSS)
  • URL (Used for metadata/RSS)
  • Description (Used for metadata/RSS; RFC3339 format)
  • Email (Used for RSS)
  • CreationDate (Used for metadata/RSS)
  • UtterancesRepo (Needed for comments)
  • MaxIndexEntries (Decides how many posts are shown per page (Default 10))
  • AddOptionalMetaData (Add metadata such as tags, description, author and so on)
  • DateFormat (Needed for human readable dates later on)

    The format requires specific numbers, it's weird.

  • UseFavicon (Decides whether to look for a favicon; true by default)

The content of the pages folder will be added as stand-alone pages. Those will show up in the header of the page and do not offer a comment-section. Nor will they be part of the RSS feed.

The articles folder is where you blog posts go. Each post will be added to the RSS feed upon page generation. Articles are written in plain HTML and you can reference any media file with /media/FILE.EXTENSION. How you structure the content of /media is up to you.

After compiling all your input, the data gets written into the folder specified as output, which is ./output by default. All data that was previously written to the output folder will be deleted. Manually created files however will be kept.

To view all available parameters, run:

./stasi-blog --help

Example

An example can be found in the example folder at the root of the repository.

Documentation

More documentation can be found in DOCS.md.

Features

  • Article overview
  • RSS Feed
  • Mobile friendly
  • Automatic Darkmode / Lightmode
  • Custom Pages (Example would be an About page)
  • Fast to load even with a slow (less than 64kbit/s) internet connection

Desktop-only features

  • Optional Tags sidebar + Tag filtering

Feature only available with JS

  • Comments via utteranc.es (via GitHub issues)

Future

I might add the option to write posts with Markdown. My main goal was the ability to write posts with HTML, but as that basically comes for free, Markdown will be an add-on.

stasi-blog's People

Contributors

bios-marcel avatar dakyskye avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mudenker

stasi-blog's Issues

Accessibility

All elements should follow accessibility standards:

  • Images
  • Header links
  • Article links
  • Tags
  • Pagination
  • RSS link

Any necessary mobile considerations?

RSS feeds need to be validated

I couldn't find a go library capable of doing this. The best thing appears to be the one that w3c offers. However, this is sadly written in python and can't be properly integrated into a golang application I assume. I'd rather not want anyone to have to integrate this. Maybe I should write my own validator.

There seems to be a SOAP API for the w3c validator, however, an internet dependency would kind of suck.

Improve output folder cleanup

Currently all files manually added to the output subfolders files will be deleted. Files manually placed directly in the output folder will be preserved.

To solve this, we need an index file. For example, if stasi generates the following folder structure:

|--articles
   |--article-1.html
|--favicon.ico
|--index.html

The generation index would look like this:

articles/article-1.html
index.html
favicon.ico

We'd then delete only the files, but not the folders and afterwards generate a new index.
The index should be deleted last, to avoid leaving behind garbage in case of failures.

Make everything human-language agnostic

Currently the following things aren't configurable:

  • The document locales
  • Locale in meta tags
  • The Written on part for expressing dates
  • The 404-page
  • The Feed in RSS-Feed
  • The Home in the nav-bar
  • The Tags on the index
  • The noscript output in articles
  • The audio fallback message

Setup CI

Setup CI for running builds and uploading releases on tagged commits.

Allow assigning authors to individual blog posts

Right now you can only specify one author for all blog posts, however if you want to use a repository with multiple people, then there is no way to assign blog posts to their respective authors.

One post could also be authored by multiple people, so it would be great to allow assigning multiple authors to one blog post.

Paging pls

I stumpled upon a stasi blog with 1 million entries and it loaded 1 million headlines instead of sth like 10 pages with just 100000 headlines. please limit the number of headlines per page to 100000 or 5 or sth in between. Le chaim.

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.