Two renderers on groups


#1

I have two groups of routes: public and private.

For example:

e := echo.New()

public := e.Group("/") // TODO: Set public theme (can be changed to other theme)
public.GET("/", indexPage) // '/'
public.GET("/about", aboutPage) // '/about'

private := e.Group("/admin") // TODO: Set dashboard templates
private.GET("/editor", adminIndex) // '/admin/editor'
private.GET("/settings", settingsPage) // '/admin/settings'

I want to assign two Renderer to each of them, each with slightly different pattern configurations.

How can i do this?


#2

You probably need subdomains. A renderer just renders HTML. With subdomains you probably can do that. Look into https://echo.labstack.com/cookbook/subdomains


#3

I’m not sure what I can afford a separate subdomain for the admin dashboard, since the public side itself can be hosted in a subdomain, like:

https://blog.example/admin/settings AND https://blog.example/about
VS
https://blog.site.example/admin/settings AND https://blog.site.example/about


#4

I honestly don’t think your question is very clear on what you need to accomplish. Two things i can recommend:

  • You talked about not affording a sub-domain. In my experience, i have three sub-domains and i only pay for the main domain. Sub-domains usually don’t cost extra to setup - not at least in my case.
  • If you just need two different themes, you can use two separate base templates for main website and admin site. This way, you just use one domain.

I think your main problem is finding a good renderer. I use pongo2.