CMS Development

MaximSiebert
Mitglied | Partner
Mitglied | Partner

Adding an editable module to a Blog Listing template

lösung

Hello!

 

I have a coded template for my blog listing page. On this page I'm including a 'Page header' module which I'm using on a various other pages. It contains a heading, description and an image, but I can't seem to find anywhere to edit the content of this module.

 

Is there a better way to achieve this without duplicating the code and hard coding the content?

0 Upvotes
1 Akzeptierte Lösung
JasonRosa
Lösung
HubSpot Employee
HubSpot Employee

Adding an editable module to a Blog Listing template

lösung

@MaximSiebert thank you for sending that over! That helped clear up your question on my end. So there isn't a front end editor for the listing page on a blog similar to how there is for a website page or a blog post. The listing page content is pulled from the code that you have on your template instead and needs to be edited primarily from your listing template.

 

With that being said, you should be able to set what you want to show in that module on the listing page through that custom module that you're adding on line 2 without having to change the module or duplicate your code efforts (but it would require coding in the content for the listing page).

 

You'd just set parameter in the module on line 2 that matches the fields that you have in the custom module. So for example say I wanted to set the "header text" and "description text". That would look something like this:

 

{% module "module_154826219847228" module_id="4635434" label="Page Header" header_text="Testing this out" description_text="hello there!"%}

 

The parameters I'm pulling from your custom module (see image): 

 

Parameters.png

 

Let me know if you have any questions about this!

 

 

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
6 Antworten
JasonRosa
HubSpot Employee
HubSpot Employee

Adding an editable module to a Blog Listing template

lösung

Hey, @MaximSiebert you could probably use if is listing view in your page header module. So basically say that you had a header tag in the module, you could set what you want to show on the listing page in the initial if statement and if it is not the listing page, you'd show what you normally had between the header tags. Example:

 

{% if is_listing_view %}

<h1>header text for listing view</h1>

{% else %}

<h1>code/text you already had set up in the module</h1>

{% endif %}

0 Upvotes
MaximSiebert
Mitglied | Partner
Mitglied | Partner

Adding an editable module to a Blog Listing template

lösung

Hey @JasonRosa, I'm using 2 templates for this blog. One for the index and one for the post page. The modules on the post page are editable through the blog post but the modules on the listing page aren't editable.

 

I thought using the same page for both listing and post, with the if statement you mentioned, would allow me to change the listing module content via the blog post but unfortunately the module doesn't show up in the module list.

 

My issue is that I can't edit the listing page module content, not that it shows up in the blog posts.

 

Thanks, hope you can help!

0 Upvotes
JasonRosa
HubSpot Employee
HubSpot Employee

Adding an editable module to a Blog Listing template

lösung

Hey, @MaximSiebert  could you send me over a link to the listing template so that I can take a closer look? 

0 Upvotes
MaximSiebert
Mitglied | Partner
Mitglied | Partner

Adding an editable module to a Blog Listing template

lösung
0 Upvotes
JasonRosa
Lösung
HubSpot Employee
HubSpot Employee

Adding an editable module to a Blog Listing template

lösung

@MaximSiebert thank you for sending that over! That helped clear up your question on my end. So there isn't a front end editor for the listing page on a blog similar to how there is for a website page or a blog post. The listing page content is pulled from the code that you have on your template instead and needs to be edited primarily from your listing template.

 

With that being said, you should be able to set what you want to show in that module on the listing page through that custom module that you're adding on line 2 without having to change the module or duplicate your code efforts (but it would require coding in the content for the listing page).

 

You'd just set parameter in the module on line 2 that matches the fields that you have in the custom module. So for example say I wanted to set the "header text" and "description text". That would look something like this:

 

{% module "module_154826219847228" module_id="4635434" label="Page Header" header_text="Testing this out" description_text="hello there!"%}

 

The parameters I'm pulling from your custom module (see image): 

 

Parameters.png

 

Let me know if you have any questions about this!

 

 

0 Upvotes
MaximSiebert
Mitglied | Partner
Mitglied | Partner

Adding an editable module to a Blog Listing template

lösung

That will do the trick! Thanks so much @JasonRosa.

0 Upvotes