1
0
Fork 0
mirror of https://github.com/Luzifer/wiki.git synced 2024-12-20 10:31:18 +00:00

Move default files, add navigation default

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-08-15 22:39:05 +02:00
parent e1d545aca7
commit f0425e1e08
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 9 additions and 3 deletions

View file

@ -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).

View file

@ -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

View file

@ -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)