diff --git a/content/thanks.md b/content/thanks.md new file mode 100644 index 0000000..01c07a7 --- /dev/null +++ b/content/thanks.md @@ -0,0 +1,5 @@ +--- +title: Thank You +navTitle: "" +showInNav: false +--- diff --git a/css/typography.css b/css/typography.css index f1020ed..cbb09fd 100644 --- a/css/typography.css +++ b/css/typography.css @@ -107,6 +107,10 @@ h3 a, .h3 a { text-decoration: underline; } +#site_head h1 a { + @apply text-white text-40px hover:text-primary-200; +} + p { margin-top: 0; margin-bottom: 1rem; diff --git a/main.go b/main.go index 060db5b..013f238 100644 --- a/main.go +++ b/main.go @@ -26,6 +26,7 @@ type NavItem struct { type PageMeta struct { Title string `yaml:"title"` NavTitle string `yaml:"navTitle"` + ShowInNav *bool `yaml:"showInNav"` Description string `yaml:"description"` Date string `yaml:"date"` Categories []string `yaml:"categories"` @@ -54,6 +55,8 @@ func main() { nav := buildNav(entries, contentDir) renderStaticPages(files, contentDir, outputDir, tpl, nav) blogPosts, categoryMap := processBlogPosts(contentDir, outputDir, tpl, nav) + renderContactPage(contentDir, outputDir, tpl, nav) + renderThanksPage(contentDir, outputDir, tpl, nav) buildBlogIndex(blogPosts, tpl, outputDir, nav) buildCategoryPages(categoryMap, tpl, outputDir, nav) @@ -83,10 +86,18 @@ func buildNav(entries []fs.DirEntry, contentDir string) []NavItem { meta, _ := parseFrontMatter(rawContent) - title := meta.NavTitle + title := strings.TrimSpace(meta.NavTitle) if title == "" { title = meta.Title } + if title == "" { + title = strings.Title(name) + } + + // Respect showInNav: false + if meta.ShowInNav != nil && !*meta.ShowInNav { + continue + } if title == "" && name == "index" { title = "Home" } else if title == "" { @@ -202,6 +213,36 @@ func renderContactPage(contentDir, outputDir string, tpl *template.Template, nav fmt.Println("Generated: /contact/") } +func renderThanksPage(contentDir, outputDir string, tpl *template.Template, nav []NavItem) { + path := filepath.Join(contentDir, "thanks.md") + rawContent, err := os.ReadFile(path) + if err != nil { + fmt.Printf("Thanks page not found: %v\n", err) + return + } + + meta, _ := parseFrontMatter(rawContent) + + outPath := filepath.Join(outputDir, "thanks", "index.html") + os.MkdirAll(filepath.Dir(outPath), os.ModePerm) + + outFile, err := os.Create(outPath) + if err != nil { + fmt.Printf("Failed to create thanks page: %v\n", err) + return + } + + tpl.ExecuteTemplate(outFile, "thanks_page", map[string]interface{}{ + "Title": meta.Title, + "Description": meta.Description, + "Nav": nav, + "Year": time.Now().Year(), + "PageTemplate": "thanks_page", + }) + + fmt.Println("Generated: /thanks/") +} + func processBlogPosts(contentDir, outputDir string, tpl *template.Template, nav []NavItem) ([]PageMeta, map[string][]PageMeta) { var blogPosts []PageMeta categoryMap := make(map[string][]PageMeta) diff --git a/public/about/index.html b/public/about/index.html index bb050d3..ee6e953 100644 --- a/public/about/index.html +++ b/public/about/index.html @@ -7,12 +7,13 @@ Go SSG - About +