sbs

A Simple Blogging System.
git clone https://git.sr.ht/~jbauer/sbs
Log | Files | Refs | README | LICENSE

commit 3adaa4ebb247cc53bc9eea2d12352fda8fb3aa9a
parent 709f3ed6fe04cf5c3f748dd59423aee93acfc569
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Mon, 14 Feb 2022 02:44:30 -0500

Add commands to create new sites and blank posts

Diffstat:
Msbs | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/sbs b/sbs @@ -6,13 +6,25 @@ # See the README for usage instructions and LICENSE for license terms. # TODO: Image optimization not using third party service? -# TODO: CSS minification without using third party service? # TODO: Live server that watches for page updates? # TODO: "New" site which creates necessary dirs and files in a directory set -o errexit set -o nounset +if [ "$1" = "new" ]; then + if [ "$2" = "post" ]; then + printf "Title: \nAuthor: \nDate: \nSummary: \n\n# [%%title]\n\n**Author:** [%%author] | **Published:** [%%date]\n\n" > "$3" + elif [ "$2" = "site" ]; then + mkdir -p "$3/content/" "$3/static/" "$3/templates/" + touch "$3/static/style.css" + printf "siteName = $3\nlanguageCode = en\nbuildOptions = -Thtml --html-no-skiphtml --html-no-escapehtml\n" > "$3/config.ini" + printf '<!DOCTYPE html>\n<html lang="">\n<head>\n\t<meta charset="utf-8">\n\t<meta name="viewport" content="width=device-width, initial-scale=1.0">\n\t<meta name="description" content="">\n\t<link rel="stylesheet" href="/style.min.css">\n\t<link rel="alternate" type="application/rss+xml" title="RSS feed" href="/feed.xml">\n\t<title></title>\n</head>\n<body>\n\t<header></header>\n\t<main>\n' > "$3/templates/header.html" + printf '\t</main>\n\t<footer></footer>\n</body>\n</html>\n' > "$3/templates/footer.html" + fi + exit 0 +fi + # Check that all the required programs are installed if [ ! -x "$(command -v lowdown)" ]; then echo "The program 'lowdown' is needed but was not found."