Add separate about and contact pages
This commit is contained in:
@@ -2,12 +2,13 @@ package routes
|
||||
|
||||
import (
|
||||
. "ersteller-lib"
|
||||
"ersteller-lib/starter/about"
|
||||
"ersteller-lib/starter/contact"
|
||||
"ersteller-lib/starter/index"
|
||||
"ersteller-lib/starter/page"
|
||||
"net/http"
|
||||
|
||||
. "maragu.dev/gomponents"
|
||||
. "maragu.dev/gomponents/html"
|
||||
)
|
||||
|
||||
func CreateApi() http.Handler {
|
||||
@@ -27,16 +28,16 @@ func CreateApi() http.Handler {
|
||||
En: "About",
|
||||
De: "Über uns",
|
||||
}, LanguagePaths{
|
||||
En: "/about",
|
||||
De: "/de/ueber-uns",
|
||||
En: about.AboutPath,
|
||||
De: about.AboutPathDe,
|
||||
})
|
||||
|
||||
contactActivePath := NewActivePath(map[Language]string{
|
||||
En: "Contact",
|
||||
De: "Kontakt",
|
||||
}, LanguagePaths{
|
||||
En: "/contact",
|
||||
De: "/de/kontakt",
|
||||
En: contact.ContactPath,
|
||||
De: contact.ContactPathDe,
|
||||
})
|
||||
|
||||
// Main navigation items
|
||||
@@ -49,53 +50,9 @@ func CreateApi() http.Handler {
|
||||
indexPage := index.NewPage(createPageFunc, server, &indexActivePath)
|
||||
server.HandleStaticAndDefaultPath(indexPage.ViewRoute, En)
|
||||
|
||||
// Add placeholder routes for About and Contact pages
|
||||
// These can be implemented as needed
|
||||
aboutRoute := NewHtmxGetRoute(func(c HtmxContext) {
|
||||
content := []Node{
|
||||
Div(Class("hero-section"),
|
||||
H1(Class("hero-title"), Text("About Us")),
|
||||
P(Class("hero-description"), Text("This is a placeholder about page. Customize this content to tell your story.")),
|
||||
),
|
||||
}
|
||||
createPageFunc(c, PageWebsiteMetaData{
|
||||
Title: NewI18nText(map[Language]string{
|
||||
En: "About",
|
||||
De: "Über uns",
|
||||
}),
|
||||
Description: NewI18nText(map[Language]string{
|
||||
En: "Learn more about us",
|
||||
De: "Erfahren Sie mehr über uns",
|
||||
}),
|
||||
}, content...)
|
||||
}, LanguagePaths{
|
||||
En: "/about",
|
||||
De: "/de/ueber-uns",
|
||||
}).SetActivePath(&aboutActivePath)
|
||||
aboutRoute.Add(server)
|
||||
|
||||
contactRoute := NewHtmxGetRoute(func(c HtmxContext) {
|
||||
content := []Node{
|
||||
Div(Class("hero-section"),
|
||||
H1(Class("hero-title"), Text("Contact Us")),
|
||||
P(Class("hero-description"), Text("This is a placeholder contact page. Add your contact information and forms here.")),
|
||||
),
|
||||
}
|
||||
createPageFunc(c, PageWebsiteMetaData{
|
||||
Title: NewI18nText(map[Language]string{
|
||||
En: "Contact",
|
||||
De: "Kontakt",
|
||||
}),
|
||||
Description: NewI18nText(map[Language]string{
|
||||
En: "Get in touch with us",
|
||||
De: "Nehmen Sie Kontakt mit uns auf",
|
||||
}),
|
||||
}, content...)
|
||||
}, LanguagePaths{
|
||||
En: "/contact",
|
||||
De: "/de/kontakt",
|
||||
}).SetActivePath(&contactActivePath)
|
||||
contactRoute.Add(server)
|
||||
// Create About and Contact pages using the new packages
|
||||
_ = about.NewPage(createPageFunc, server, &aboutActivePath)
|
||||
_ = contact.NewPage(createPageFunc, server, &contactActivePath)
|
||||
|
||||
serverWithMiddleWare := UseMiddleware(server, LoggingMiddleware, MakeGzipHandler)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user