Add site description to home page
This commit is contained in:
parent
b86b1688ea
commit
1db5336f35
6 changed files with 24 additions and 5 deletions
Binary file not shown.
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 48 KiB |
Binary file not shown.
Before Width: | Height: | Size: 200 KiB After Width: | Height: | Size: 200 KiB |
14
main.go
14
main.go
|
@ -16,10 +16,11 @@ var appTemplate *template.Template = template.New("app")
|
||||||
var db Database
|
var db Database
|
||||||
|
|
||||||
type TemplateData struct {
|
type TemplateData struct {
|
||||||
TOC []string
|
|
||||||
Entry string
|
|
||||||
Title string
|
Title string
|
||||||
|
SiteDescription string
|
||||||
|
TOC []string
|
||||||
EntryTitle string
|
EntryTitle string
|
||||||
|
Entry string
|
||||||
Footer []template.HTML
|
Footer []template.HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +43,14 @@ func handleApplication(w http.ResponseWriter, req *http.Request) {
|
||||||
}
|
}
|
||||||
err = appTemplate.ExecuteTemplate(
|
err = appTemplate.ExecuteTemplate(
|
||||||
w, "app",
|
w, "app",
|
||||||
TemplateData{TOC: db.Keys, Entry: entry, Title: MainTitle, EntryTitle: entryName, Footer: FooterContent})
|
TemplateData{
|
||||||
|
TOC: db.Keys,
|
||||||
|
Entry: entry,
|
||||||
|
Title: MainTitle,
|
||||||
|
EntryTitle: entryName,
|
||||||
|
Footer: FooterContent,
|
||||||
|
SiteDescription: SiteDescription,
|
||||||
|
})
|
||||||
if err != nil { logger.Println(err) }
|
if err != nil { logger.Println(err) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
</div>
|
</div>
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
<div class="home-main">
|
<div class="home-main">
|
||||||
|
<div class="about">
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
{{ if .SiteDescription }}<div class="description">{{ .SiteDescription }}</div>{{ end }}
|
||||||
|
</div>
|
||||||
<input type="text" id="search-box" placeholder="search">
|
<input type="text" id="search-box" placeholder="search">
|
||||||
<div id="search-results" class="hidden"></div>
|
<div id="search-results" class="hidden"></div>
|
||||||
<div class="toc" id="toc">
|
<div class="toc" id="toc">
|
||||||
|
|
|
@ -62,9 +62,15 @@ footer, footer * {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
.home-main > h1 {
|
.about {
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
}
|
||||||
|
.about > h1 {
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
}
|
}
|
||||||
|
.description {
|
||||||
|
white-space: pre-line;
|
||||||
|
}
|
||||||
.home-main, .toc, #search-results {
|
.home-main, .toc, #search-results {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -14,6 +14,8 @@ const StaticDirectory = "./public/static"
|
||||||
var ContentLanguage = language.English
|
var ContentLanguage = language.English
|
||||||
|
|
||||||
const MainTitle = "Encyclopedia"
|
const MainTitle = "Encyclopedia"
|
||||||
|
var SiteDescription = `A very simple and clean reader/browser?
|
||||||
|
for plaintext... documentation? wiki? chapters of a book? whatever.`
|
||||||
var FooterContent = []template.HTML{
|
var FooterContent = []template.HTML{
|
||||||
template.HTML("powered by <a href='https://github.com/ChaoticByte/plaintext-encyclopedia' target='_blank' rel='noopener noreferrer'>plaintext-encyclopedia</a>"),
|
template.HTML("powered by <a href='https://github.com/ChaoticByte/plaintext-encyclopedia' target='_blank' rel='noopener noreferrer'>plaintext-encyclopedia</a>"),
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue