mirror of
https://github.com/Luzifer/wiki.git
synced 2024-11-08 06:40:09 +00:00
Move default files, add navigation default
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
e1d545aca7
commit
f0425e1e08
3 changed files with 9 additions and 3 deletions
|
@ -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).
|
3
default_files/navigation.md
Normal file
3
default_files/navigation.md
Normal 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
|
7
main.go
7
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)
|
||||
|
|
Loading…
Reference in a new issue