blue-jay / blueprint

Blueprint for your next web application in Go.
https://blue-jay.github.io/
MIT License
482 stars 77 forks source link

Dynamic Menu and Content #77

Open Light-Wizzard opened 6 years ago

Light-Wizzard commented 6 years ago

Feature request:

  1. Which commit are you using? 178
  2. Which operating system, processor architecture, and Go version are you using (go env)? Arch Linux Manjaro, GOHOSTOS="linux", GOHOSTARCH="amd64", go version go1.10.3 linux/amd64

Dynamic Menu and Content Maintaining a Static Site is hard to do, there should be a way to Dynamically add Menu items and Content.

In the Controller.go LoadRoutes, it would be easy enough to iterate through the database for dynamic menu items, and store a template name and content in database entry for menu item and store a static template in a Dynamic Menu Folder, I know this would be a major change, but one everyone would agree with, Dynamic and Static should mix well. I have just started to use this framework so I am not yet fully familiar with the code enough to make the changes, so I thought I would suggest it and see what your thoughts are, and to see if this issue has already be addressed.

Update: Grant you I can make this Dynamic in my Front End as it is, but its not Database Driven, and it seems that might be faster, but only benchmarks would determine. Static pages cache better so maybe you can ignore this request if that is the case.

josephspurrier commented 6 years ago

That's a good point - a dynamic menu package would be a nice additional. You can create your own template functions in Blue Jay:

https://blue-jay.github.io/views/#view-functions

You can write a function that generates the menu in Go so you don't have to define it in your templates.