feat(nav): add an optional projects page to the menu
kmalloc.org wants a "Projects" entry between People and Services, linking to a page listing the software it currently builds. Adds "projects" to the menu, the linked pages and the required pages, and keeps the test fixtures (and the main_test page count) in sync.
This commit is contained in:
parent
f92d5e8cb4
commit
1505e5d782
4 changed files with 7 additions and 5 deletions
|
|
@ -28,7 +28,7 @@ func miniSite(t *testing.T) string {
|
||||||
"templates/pages/page.html": "<h1>{{page_title}}</h1>{{body}}\n",
|
"templates/pages/page.html": "<h1>{{page_title}}</h1>{{body}}\n",
|
||||||
"templates/post.html": "{{post_body}}\n", "templates/category.html": "{{category_posts}}\n",
|
"templates/post.html": "{{post_body}}\n", "templates/category.html": "{{category_posts}}\n",
|
||||||
}
|
}
|
||||||
for _, id := range []string{"home", "manifesto", "people", "services", "news", "history"} {
|
for _, id := range []string{"home", "manifesto", "people", "projects", "services", "news", "history"} {
|
||||||
name := id
|
name := id
|
||||||
switch id {
|
switch id {
|
||||||
case "home":
|
case "home":
|
||||||
|
|
@ -71,7 +71,7 @@ func TestRunBuildSuccess(t *testing.T) {
|
||||||
if code != 0 {
|
if code != 0 {
|
||||||
t.Fatalf("run(build) = %d, stderr %q", code, errOut.String())
|
t.Fatalf("run(build) = %d, stderr %q", code, errOut.String())
|
||||||
}
|
}
|
||||||
if want := "built 6 pages into " + outDir; !strings.Contains(out.String(), want) {
|
if want := "built 7 pages into " + outDir; !strings.Contains(out.String(), want) {
|
||||||
t.Errorf("output %q does not contain %q", out.String(), want)
|
t.Errorf("output %q does not contain %q", out.String(), want)
|
||||||
}
|
}
|
||||||
if _, err := os.Stat(filepath.Join(outDir, "index.html")); err != nil {
|
if _, err := os.Stat(filepath.Join(outDir, "index.html")); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ type Options struct {
|
||||||
|
|
||||||
// requiredPages are the IDs every site must have in its default language,
|
// requiredPages are the IDs every site must have in its default language,
|
||||||
// because the menu and the footer link to them.
|
// because the menu and the footer link to them.
|
||||||
var requiredPages = []string{"home", "manifesto", "people", "services", "news", "history"}
|
var requiredPages = []string{"home", "manifesto", "people", "projects", "services", "news", "history"}
|
||||||
|
|
||||||
// newsOnHome is how many news the home page lists; feedLimit is how many the feed has.
|
// newsOnHome is how many news the home page lists; feedLimit is how many the feed has.
|
||||||
const (
|
const (
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// menuPages are the IDs of the pages in the menu; the current one is marked.
|
// menuPages are the IDs of the pages in the menu; the current one is marked.
|
||||||
var menuPages = []string{"home", "manifesto", "people", "services", "news"}
|
var menuPages = []string{"home", "manifesto", "people", "projects", "services", "news"}
|
||||||
|
|
||||||
// linkedPages are the IDs the templates link to with url_<id>.
|
// linkedPages are the IDs the templates link to with url_<id>.
|
||||||
var linkedPages = []string{"manifesto", "people", "services", "news", "history"}
|
var linkedPages = []string{"manifesto", "people", "projects", "services", "news", "history"}
|
||||||
|
|
||||||
// blockNames are the placeholders that expand to generated HTML. Until they
|
// blockNames are the placeholders that expand to generated HTML. Until they
|
||||||
// are expanded they stand for themselves, so a page can hold them.
|
// are expanded they stand for themselves, so a page can hold them.
|
||||||
|
|
|
||||||
|
|
@ -94,12 +94,14 @@ func baseFiles() map[string]string {
|
||||||
"content/en/manifesto.md": page("manifesto", "Manifesto", "Layout: manifesto\n", "## 01 — Antifascist\n\nText one.\n\n## Our commitments\n\nText two.\n"),
|
"content/en/manifesto.md": page("manifesto", "Manifesto", "Layout: manifesto\n", "## 01 — Antifascist\n\nText one.\n\n## Our commitments\n\nText two.\n"),
|
||||||
"content/en/manifesto-history.md": page("history", "Manifesto history", "", "Versions.\n"),
|
"content/en/manifesto-history.md": page("history", "Manifesto history", "", "Versions.\n"),
|
||||||
"content/en/people.md": page("people", "People", "", "## squid\n\nI run it.\n"),
|
"content/en/people.md": page("people", "People", "", "## squid\n\nI run it.\n"),
|
||||||
|
"content/en/projects.md": page("projects", "Projects", "", "## motorino\n\nThis.\n"),
|
||||||
"content/en/services.md": page("services", "Services", "Switch: it=/it/servizi.html\n", "Write to **{{contact_shown}}**.\n"),
|
"content/en/services.md": page("services", "Services", "Switch: it=/it/servizi.html\n", "Write to **{{contact_shown}}**.\n"),
|
||||||
"content/en/news/index.md": page("news", "News", "", "{{news_list}}\n\n{{categories_list}}\n"),
|
"content/en/news/index.md": page("news", "News", "", "{{news_list}}\n\n{{categories_list}}\n"),
|
||||||
"content/it/index.md": page("home", "kmalloc.org", "Layout: bare\n", "{{latest_news}}\n"),
|
"content/it/index.md": page("home", "kmalloc.org", "Layout: bare\n", "{{latest_news}}\n"),
|
||||||
"content/it/manifesto.md": page("manifesto", "Manifesto", "Layout: manifesto\n", "## 01 — Antifascisti\n\nTesto.\n"),
|
"content/it/manifesto.md": page("manifesto", "Manifesto", "Layout: manifesto\n", "## 01 — Antifascisti\n\nTesto.\n"),
|
||||||
"content/it/cronologia-manifesto.md": page("history", "Cronologia", "", "Versioni.\n"),
|
"content/it/cronologia-manifesto.md": page("history", "Cronologia", "", "Versioni.\n"),
|
||||||
"content/it/persone.md": page("people", "Persone", "", "Io.\n"),
|
"content/it/persone.md": page("people", "Persone", "", "Io.\n"),
|
||||||
|
"content/it/progetti.md": page("projects", "Progetti", "", "## motorino\n\nQuesto.\n"),
|
||||||
"content/it/servizi.md": page("services", "Servizi", "", "Scrivi a {{contact_shown}}.\n"),
|
"content/it/servizi.md": page("services", "Servizi", "", "Scrivi a {{contact_shown}}.\n"),
|
||||||
"content/es/manifesto.md": page("manifesto", "Manifiesto", "Layout: manifesto\nNote: Traduccion de la version 1.0.\nManifestoVersion: 1.0\nManifestoDate: 2026-11-12\n", "## 01 — Antifascistas\n\nTexto.\n"),
|
"content/es/manifesto.md": page("manifesto", "Manifiesto", "Layout: manifesto\nNote: Traduccion de la version 1.0.\nManifestoVersion: 1.0\nManifestoDate: 2026-11-12\n", "## 01 — Antifascistas\n\nTexto.\n"),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue