Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Sidebar and widget management

Started by S Larcher 7 years ago · 2 replies · 2287 views
7 years ago

Hi guys,

Before I dig into this I thought to ask preventively the folks.
Would like to come up with a good solution for sidebar and widgets management.

Assume following:

  • Got multiple page templates in use
  • Got multiple sidebars setup (sidebar-a.html.twig, sidebar-b.html.twig under partials/sidebars)
  • Got multiple sidebar widgets setup (widget-a.html.twig, widget-b.html.twig under partials/widgets)

I would like to:

  • Be able to manage the widgets content in the admin console - similar to modular pages - a WYSIWYG editor field per widget will do.
  • Be able to allocate any widget to any sidebar, possibly order them, via admin console
  • Be able to allocate any sidebar to any page template via admin console

Anyone got a golden bullet idea or best approach?

Thanks!
Sam

7 years ago

Hi @slarcher, I do something like this to support a user-editable Sidebar and Footer in my Bootstrap4 Open Matter and Quark Open Publishing themes:
https://github.com/hibbitts-design/grav-theme-quark-open-publishing/blob/master/templates/partials/sidebar.html.twig#L13-L20

https://github.com/hibbitts-design/grav-theme-quark-open-publishing/blob/master/templates/partials/base.html.twig#L119-L123

https://github.com/hibbitts-design/grav-skeleton-open-publishing-space/tree/master/pages

If you download and explore the Open Publishing Space skeleton you can see a working example of this.

Hope the above helps,
Paul

7 years ago

Thanks @paulhibbitts ! I will take a look.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 80 9 hours ago
General · by pamtbaau, 14 hours ago
1 51 13 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago