Modifying Modular/partials Contents from Admin

I’m just getting started with Grav (Coming from Wordpress theme dev) and so far, I’m loving the potential that I’m seeing with Grav. I have some questions though.
I’ve read a lot of the documentation and have been digging through a several of the skeletons to get an understanding. I’m hoping to be able to use this for simple sites that my clients can make chages to through the admin plugin.

  1. Is there a way to update the sidebar content without digging into the twig templates every time? My first thought would be to create a page template for sidebar (that isn’t visible on the front end) that they could add specific content to and then include that template within the blog template.
  2. For the Modular pages, I’m seeing a lot of the skeletons setup with great styling and layouts but when looking at how they are built, it doesn’t seem very user-friendly. For example, in the Holcyon Site skeleton, it looks like you have to modify the content in the different modules through their front matter. Is there a way to build that template so that the client could easily edit tha t content through the regular editor? In Wordpress Land it would be similar to a custom field or maybe a text widget area.

I don’t mind getting my hands dirty or doing more research, but if you guys could point me in the right direction, that would be awesome :slight_smile: Thanks!

Also, why are there no themes built with bourbon/bitters/neat? Maybe I can make a contribution to the community once I get my “sea legs!”

Hi,

  1. Since Grav assumes nothing about the frontend, this must be handled by the theme. You can setup the theme to include a page, like you said, you can also add a setting to the theme blueprint to allow editing the sidebar content in the theme configuration.

  2. Yes, Pages Blueprints are made for this. In short, any field you see in the Admin when you edit a page has been added to the Page blueprint. Any page type has different page blueprints, and the theme/plugins can add new ones.
    See the system (default) pages blueprints and the blueprints provided by the Antimatter theme

  3. As for the theme framework, no special reason - simply a theme choice :slight_smile:

Ah, Awesome! Ok, so I played around with it a bit. and it’s getting there. I have everything working properly except for the toggle option. I wanted to default it to “disabled” but whenever you enable it and save the page, when you refresh it is disabled again? What am I missing here?

From the blueprint:

         fields:
            page.header.optional_sidebar:
              type: toggle
              label: Include Sidebar on Page
              help: Toggle to enable sidebar on this page.
              hightlight: 1
              default: 0
              options:
                1: Enabled
                0: Disabled
              Validate:
                type: bool

That first “fields” part is in the right place in my code, the spacing just got off a little in the reply.

Looks ok apart from hightlight -> highlight, Validate -> validate, can you try with those little fixes in?

Should’ve know there would be a typo in the code. Sheesh. Unfortunately, that didn’t fix the issue. Here’s a quick video clip of how it’s acting. https://v.usetapes.com/dhyr3ulc7S

hi, you miss this line:
toggleable: true

I just tested it by adding “toggleable: true” to the blueprint. That adds a checkbox to the sidebar tab but it still doesn’t change the fontmatter. What else could I be missing here?

I’m also stucked on that. We need somehow a variable that can be used in sidebar.html.twig. if we see the content of sidebar.html.twig, it uses variables from config.plugins. what we don’t know is how to get a value of a blueprint’s config which can be used in a twig file.

I used “if” statements in the twig file based on the blueprint/frontmatter. But understanding how to get it to play well with the admin interface has been difficult for me.

Just a thought, but have you tried to clear ALL cache? I have found that many small issues go away when doing this.