From 42579fe07d92266942eb853aba489d7a9a51ce58 Mon Sep 17 00:00:00 2001 From: Dario Ernst Date: Sun, 19 Dec 2021 15:46:56 +0100 Subject: [PATCH] Add ability for web-viewing --- Makefile | 6 +++++- config.toml | 4 +++- themes/cookbook/layouts/_default/baseof.html | 8 ++++++++ themes/cookbook/layouts/index.html | 7 +++++++ themes/cookbook/layouts/partials/summary.html | 1 + 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 themes/cookbook/layouts/_default/baseof.html create mode 100644 themes/cookbook/layouts/index.html create mode 100644 themes/cookbook/layouts/partials/summary.html diff --git a/Makefile b/Makefile index bb179c8..9a5ad8b 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ all: hugo $(objects) $(output)/%.pdf: $(source)/%.md chromium --temp-profile --headless --disable-gpu --run-all-compositor-stages-before-draw --allow-file-access-from-files --allow-running-insecure-content --print-to-pdf-no-header --print-to-pdf="$@" "public/print/$(notdir $(basename $@))/print.html" -.PHONY : clean hugo +.PHONY : clean hugo deploy clean: rm -rf pdf/ public/ @@ -15,3 +15,7 @@ clean: hugo: hugo mkdir -p pdf + +deploy: + scp -r public/* dario@ghostdub.de:~/www-data/rezepte/ + scp pdf/*.pdf dario@ghostdub.de:~/www-data/rezepte/print/ diff --git a/config.toml b/config.toml index 3a23eb2..b3cd998 100644 --- a/config.toml +++ b/config.toml @@ -1,10 +1,12 @@ -baseURL = "http://example.org/" +baseURL = "https://rezepte.kanojo.de/" languageCode = "en-us" title = "My Cookbook" theme = "cookbook" +sectionPagesMenu = "main" # Print output just creates a special route for a print view [outputs] + home = ["HTML"] page = ["PRINT"] [outputFormats] diff --git a/themes/cookbook/layouts/_default/baseof.html b/themes/cookbook/layouts/_default/baseof.html new file mode 100644 index 0000000..924b72c --- /dev/null +++ b/themes/cookbook/layouts/_default/baseof.html @@ -0,0 +1,8 @@ + + + +
+ {{- block "main" . }}{{ end }} +
+ + diff --git a/themes/cookbook/layouts/index.html b/themes/cookbook/layouts/index.html new file mode 100644 index 0000000..bbac98a --- /dev/null +++ b/themes/cookbook/layouts/index.html @@ -0,0 +1,7 @@ +{{ define "main" }} + {{ range $index, $element := .Site.RegularPages }} {{/* Ranging over all the posts */}} +
+ {{ partial "summary.html" . }} {{/* pass in the element to the partial */}} +
+ {{ end }} +{{ end }} diff --git a/themes/cookbook/layouts/partials/summary.html b/themes/cookbook/layouts/partials/summary.html new file mode 100644 index 0000000..9f36099 --- /dev/null +++ b/themes/cookbook/layouts/partials/summary.html @@ -0,0 +1 @@ +

{{ $.Title }} (PDF)