frontend.go 730 B

123456789101112131415161718192021222324252627282930313233343536
  1. package main
  2. import (
  3. "golang-fave/engine/wrapper"
  4. )
  5. type MenuItem struct {
  6. Name string
  7. Link string
  8. Active bool
  9. }
  10. type TmplData struct {
  11. MetaTitle string
  12. MetaKeywords string
  13. MetaDescription string
  14. MenuItems []MenuItem
  15. }
  16. func handleFrontEnd(e *wrapper.Wrapper) bool {
  17. if e.R.URL.Path == "/" {
  18. return e.TmplFrontEnd("index", TmplData{
  19. MetaTitle: "Meta Title",
  20. MetaKeywords: "Meta Keywords",
  21. MetaDescription: "Meta Description",
  22. MenuItems: []MenuItem{
  23. {Name: "Home", Link: "/", Active: true},
  24. {Name: "Item 1", Link: "/#1", Active: false},
  25. {Name: "Item 2", Link: "/#2", Active: false},
  26. {Name: "Item 3", Link: "/#3", Active: false},
  27. },
  28. })
  29. }
  30. return false
  31. }