add favicon and put NAVIGATION first in page list

This commit is contained in:
Iris Lightshard 2024-03-16 23:42:53 -06:00
parent e4ae62ad7b
commit 1d743646c5
Signed by: nilix
GPG key ID: 688407174966CAF3
5 changed files with 14 additions and 5 deletions

View file

@ -1,4 +1,4 @@
Copyright 2022 Derek Stevens <nilix@nilfm.cc> Copyright 2024 Iris LIghtshard <nilix@nilfm.cc>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View file

@ -77,9 +77,10 @@ func (self *EurekaAdapter) ListPages() map[string]string {
} }
pages := map[string]string{} pages := map[string]string{}
pages["meta.nav.htm"] = "NAVIGATION"
for _, file := range files { for _, file := range files {
filename := file.Name() filename := file.Name()
if strings.HasSuffix(filename, ".htm") { if strings.HasSuffix(filename, ".htm") && filename != "meta.nav.htm" {
pages[filename] = strings.Replace( pages[filename] = strings.Replace(
strings.TrimSuffix(filename, ".htm"), "_", " ", -1) strings.TrimSuffix(filename, ".htm"), "_", " ", -1)
} }
@ -195,7 +196,7 @@ func (self *EurekaAdapter) FormattingHelp() string {
func (self *EurekaAdapter) CreatePage(slug, title, content string) error { func (self *EurekaAdapter) CreatePage(slug, title, content string) error {
// eureka creates titles from slugs, so we transform the title into the slug // eureka creates titles from slugs, so we transform the title into the slug
slug = strings.ReplaceAll(title, " ", "_") + ".htm" slug = strings.ToLower(strings.ReplaceAll(title, " ", "_")) + ".htm"
path := filepath.Join(self.Root, "inc", slug) path := filepath.Join(self.Root, "inc", slug)
if strings.Contains(slug, "../") || strings.Contains(slug, "..\\") { if strings.Contains(slug, "../") || strings.Contains(slug, "..\\") {
@ -217,7 +218,7 @@ func (self *EurekaAdapter) CreatePage(slug, title, content string) error {
func (self *EurekaAdapter) SavePage(oldSlug, newSlug, title, content string) error { func (self *EurekaAdapter) SavePage(oldSlug, newSlug, title, content string) error {
// eureka creates titles from slugs, so we transform the title into the slug // eureka creates titles from slugs, so we transform the title into the slug
newSlug = strings.ReplaceAll(title, " ", "_") + ".htm" newSlug = strings.ToLower(strings.ReplaceAll(title, " ", "_")) + ".htm"
if strings.Contains(newSlug, "../") || strings.Contains(newSlug, "..\\") || if strings.Contains(newSlug, "../") || strings.Contains(newSlug, "..\\") ||
strings.Contains(oldSlug, "../") || strings.Contains(oldSlug, "..\\") { strings.Contains(oldSlug, "../") || strings.Contains(oldSlug, "..\\") {

BIN
static/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

View file

@ -11,7 +11,14 @@
<div class="page-list"> <div class="page-list">
<ul> <ul>
{{ range $slug, $title := $pages }} {{ range $slug, $title := $pages }}
{{ if eq $title "NAVIGATION" }}
<li><a href="/edit/{{$slug}}">{{$title}}</a></li> <li><a href="/edit/{{$slug}}">{{$title}}</a></li>
{{ end }}
{{ end }}
{{ range $slug, $title := $pages }}
{{ if ne $title "NAVIGATION" }}
<li><a href="/edit/{{$slug}}">{{$title}}</a></li>
{{ end }}
{{ end }} {{ end }}
</ul> </ul>
</div> </div>

View file

@ -6,6 +6,7 @@
<meta name='description' content='Nirvash CMS'/> <meta name='description' content='Nirvash CMS'/>
<meta name='viewport' content='width=device-width,initial-scale=1'> <meta name='viewport' content='width=device-width,initial-scale=1'>
<link rel='stylesheet' type='text/css' href='/static/style.css'> <link rel='stylesheet' type='text/css' href='/static/style.css'>
<link rel='shortcut icon' href='/static/favicon.png'>
<title>Nirvash &mdash; CMS</title> <title>Nirvash &mdash; CMS</title>
</head> </head>
<body> <body>