This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Johnathan Heath
Johnathan Heath

Hey, I'm not sure if this is the correct place to ask this, thought it'd be worth a shot to post on both here and the static pages support section on github. I'm currently developing a website that will have a blog (not the main feature of the website). I've been using layouts with static pages as a lot of the components appear across all pages including on the blog pages. The issue I'm currently encountering is that the static pages plugin does not allow the use of slugs in the url which makes it almost incompatible with the blog plugin as a single blog needs a slug url. I've tried to create a normal OCMS page and using {% page %} to try and link the page to the layout. The closest thing I've gotten is to create static pages with the same url as the slug for example /blog/blog-name-here and even then it still does not render the blog information. Is there another option here? I've done some research and it seems that people have hardcoded the URL to get around it. It feels like there's something I'm missing here, it'd be strange for these two plugins to not be fully compatible with each other, atleast in my mind.

Last updated

JenniferLopez
JenniferLopez

@Johnathan Heath

Generally, what I tend to do with sites using both is that I use a static page for the category view only - with the static page representing one particular category.

I will set up a snippet using a partial that contains a Posts component instance, and using the snippet properties, link the snippet property value to the Category component's categoryFilter property. This allows me to define which category to show on the static page when using the snippet. I generally will then hardcode the postPage property in the partial to point to the CMS page that I have set up to display the actual post.

You may, of course, define more snippet properties to point to the other Category component properties if you wish.

They are compatible with each other in the sense that they can work side-by-side, but both plugins essentially provide the same functionality - user-defined content for a page, which is why they don't necessarily "merge" together.

You can see details on how to create snippets here: https://github.com/rainlab/pages-plugin/blob/master/docs/documentation.md#snippets

I hope that all makes sense :)

Johnathan Heath
Johnathan Heath

Hey, thanks for the speedy reply. That makes perfect sense. It kept bugging me that I was missing something so just wanted to confirm. Will look into the snippets. Thanks a lot!

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.