SOLVED - Create an editable sidebar

I’m working on a project that has a sidebar that changes frequently and needs to be updated by the client. I’m not sure how to implement this using Kirby. If I make the sidebar a snippet, then it’s code not content. I’m sure there’s an easy way to handle this, but I haven’t figured it out searching the docs or forum.

1 Like

Do you have authorization in place yet? That’s where I would begin, first. You wouldn’t want the content to be editable globally.

Just to be clear, you want the content to be editable on the frontend, correct?

If it is a single sidebar that is pretty much present/valid for the whole website, you could store the editable content as $site variables.

Also: Do you want it to be editable on the front-end or just in the panel?

You can see the actual site here: thefestivalmagician.com

The upcoming appearances is updated all the time, but it is consistent across the entire site. I want to be able to update this in one place. Either through the panel or directly in the content folder.

Thanks.

The best solution in my opinion is a invisible article with the name “sidebar” (or whatever). Then you can access the content on every page with:

$site->page('sidebar')->events()
4 Likes

Immediately what comes to mind is setting up a custom post type with custom fields. I’ll be honest, I haven’t worked with Kirby 2 that much so I’m not sure if there’s an easier way with regards to its new functionality. But this is how I’d go about it before brushing up on Kirby 2.

You could store the upcoming events in a separate invisible page and use structured fields ($events) to add new events. Then in the sidebar snippet call upon these events

<?php
    page('events')->events()->yaml();
?>

The invisible article idea was the only way I could think of. It just seemed like a bit of hack. But it would work. I’ll experiment with the custom post type/field idea. Thanks BenSeitz and chrisburton.

I’d second that. Plus, you could set up each event as subpage of that ‘sidebar’ page with an event-template & blueprint (http://getkirby.com/docs/panel/blueprints). Or just as structured data / YAML on the ‘sidebar’ page.

If you don’t wanna go for an invisible page, you could also set up the YAML data within the $site variables. Tho not sure if that’s so much less hack-y.

2 Likes

I don’t think it’s really hack-y. Just a clean and easy solution.

Implementing this over site is an alternative, if there aren’t any subpages.

To be clear, by “custom post type”, I was referring to Blueprint as @distantnative linked to above. Hope that didn’t cause any confusion.

I wouldn’t regard this as a hacky solution, either. Setting it up as a separate page has the additional advantage that you can elaborate on it later on should you decide to have it as a single page rather than as a sidebar or set up an events calendar view.

4 Likes

And you can edit it (make it an invisible page) and its visible subpages (which may be blocks in the sidebar) in the panel using normal blueprints.
Hint:
Build a snippet (e.g. “sidebar.php”) with the content of the sidebar, which you include e.g. in every page. The rest is CSS.

Awesome brainstorming flowing around.
Does anyone have a repo draft of this menu concept? I’m still getting familiar with Kirby.
Thanks