From c44b9428e3e51f20ee74b59eefd49e494b67fcf3 Mon Sep 17 00:00:00 2001 From: Andy Watkins Date: Thu, 16 Nov 2023 19:44:04 +0000 Subject: [PATCH] new script to create some content --- create-default-content.sh | 105 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 create-default-content.sh diff --git a/create-default-content.sh b/create-default-content.sh new file mode 100644 index 0000000..369af8f --- /dev/null +++ b/create-default-content.sh @@ -0,0 +1,105 @@ + + +THEME_NAME="simpletheme" + +# Create a minimal config file. +if [ ! -f config.json ]; then + echo "CREATING config.json" + cat < config.json +{ + "theme": "$THEME_NAME" +} +EOF +fi + +# Create a minimal content file, if ./content is empty. +if [ -z "$(ls content)" ] ; then + echo "CREATING an example content file: content/example_content.html" + creation_date=$(date +'%Y-%m-%d %H:%M') + cat << EOF > content/example_content.html + + + A title + + + +

this is example content

+

+ The source material used to create whole web pages is + stored in the "content/" folder, just like this page. +

+

+ A page must have a <title> tag. Other page metadata + can be specified using <meta> tags. See the source + of this page for examples. Valid metadata tags are: + date, summary, tags, categories and template (to specify + an alternative template) +

+

+ Note There must be at least one HTML tag inside the <body> + section. A trailing <br> will be enough. +

+

+ "pages" in the "content/" folder (and "generated pages" + in "_meta"/) are then merged with the appropriate theme + template to generate the resultant HTML pages, which are + saved to the "output/" folder. The default theme is + specified in the 'config.json' file. +

+

+

+ For more information, see the + documentation in the GitHub Repository. + + +EOF +fi + + +# Make the folder structure for the theme +mkdir -p themes/$THEME_NAME/static +mkdir -p themes/$THEME_NAME/templates + + +if [ ! -f themes/$THEME_NAME/static/style.css ]; then + echo "CREATING default CSS file in themes/$THEME_NAME/templates/" + cat < themes/$THEME_NAME/static/style.css +html { + font-family: Arial, Helvetica, sans-serif; +} +EOF +fi + +if [ ! -f themes/$THEME_NAME/templates/common.thtml ]; then + echo "CREATING default theme files in themes/$THEME_NAME/templates/" + cat < themes/$THEME_NAME/templates/common.thtml + + + + {{ title }} + + + + {{ article }} + +
+ +
+ Tags: {{ tags_html }} +
+
+ Categories {{ categories_html }} +
+ + +EOF +fi + +if [ ! -f themes/$THEME_NAME/templates/navigation.thtml ]; then + echo "COPYING common.thtml to create navigation.thtml theme file." + cp themes/$THEME_NAME/templates/common.thtml themes/$THEME_NAME/templates/navigation.thtml +fi +