From f0425e1e087f7711fc082259ee549c3b83faae1b Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 15 Aug 2019 22:39:05 +0200 Subject: [PATCH] Move default files, add navigation default Signed-off-by: Knut Ahlers --- home.md => default_files/home.md | 2 ++ default_files/navigation.md | 3 +++ main.go | 7 ++++--- 3 files changed, 9 insertions(+), 3 deletions(-) rename home.md => default_files/home.md (86%) create mode 100644 default_files/navigation.md diff --git a/home.md b/default_files/home.md similarity index 86% rename from home.md rename to default_files/home.md index a709740..9d74a1f 100644 --- a/home.md +++ b/default_files/home.md @@ -6,4 +6,6 @@ You've successfully started the software and entered the frontend. Now you can e When editing you can use [Markdown](https://en.wikipedia.org/wiki/Markdown) to style your contents. If you are familiar with it you should find everything as you are used to with one exception: Inside this Wiki you can link any [[Page]] using double brackets. Those will automatically get rewritten into internal links which have slightly different loading behaviour than external links. But even creating those will work just fine. +To add links to the top navigation you can just edit the [[Navigation]] page and add them there. (Afterwards you need to reload once to refresh the navigation.) + In case you experience trouble, have feature requests or feedback just visit the [Issue-Tracker](https://github.com/Luzifer/wiki/issues) on Github or take a look at the [Code](https://github.com/Luzifer/wiki). diff --git a/default_files/navigation.md b/default_files/navigation.md new file mode 100644 index 0000000..bd07e68 --- /dev/null +++ b/default_files/navigation.md @@ -0,0 +1,3 @@ +! Just list your page names for the navigation here +! lines starting with an exclamation mark count as a +! comment and will not be displayed diff --git a/main.go b/main.go index c2c4f99..15eeafc 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,6 @@ package main -//go:generate go-bindata -pkg $GOPACKAGE -o assets.go -modtime 1 -md5checksum ./frontend/... home.md +//go:generate go-bindata -pkg $GOPACKAGE -o assets.go -modtime 1 -md5checksum ./frontend/... ./default_files/... import ( "bytes" @@ -104,13 +104,14 @@ func handlePageRead(w http.ResponseWriter, r *http.Request) { // All okay, render follows case errFileNotFound: - if sanitizeFilename(vars["page"]) != "home.md" { + initContent, err := Asset(path.Join("default_files", sanitizeFilename(vars["page"]))) + if err != nil { http.Error(w, "Page not yet exists", http.StatusNotFound) return } // Deliver initial "Home" page - file = &storedFile{Content: string(MustAsset("home.md"))} + file = &storedFile{Content: string(initContent)} default: http.Error(w, err.Error(), http.StatusInternalServerError)