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

daveharrison5796
daveharrison5796

I have made some layout/design changes to the component partials of the blog plugin to make it fit my theme design. When I updated the blog I lost all the changes.IS there a "correct; way to implement design changes like these so as not to loose them??

alxy
alxy

Yes... create a folder in the partials-directory of your theme with a name of the alias of the component, e.g. blogPosts. Put the component partials in that folder and modify them to fit your needs ;)

Tiipiik
Tiipiik

Hi,

Yes, never modify views directly from a plugin, or you might have the same problem.

Instead create a folder with a name for your override (for example user_signin/default.htm if you want to override the User SignIn view of the component, then in your page, set your component with the name of your folder you just create. So you will have something like this at the top of the page (edit the page in a code editor, not from the backend):

[account user_signin]

Then, where you want to display the component, don't make:

{% component 'account' %} 

as you waill have done normaly, but instead make this:

{% component 'user_signin' %}

And/Or take a look at the doc

Last updated

daveharrison5796
daveharrison5796

Thanks for your help so far, but I'm not quite there yet. I have tried to do what you have detailed in your responses but it looks like the files from the blog plugin are still being referenced (in other words the override is not being implemented) (I have altered the mark up slightly so i know which file is being referenced) . Could i be missing something simple?

I have added files like this

  • themes/mythemename/partials/blogPosts/post/default.htm
  • themes/mythemename/partials/blogPosts/posts/default.htm
  • themes/mythemename/partials/blogPosts/categories/default.htm

I am trying to override files located as detailed below:

  • plugins/rainlab/blog/components/post/default.htm
  • plugins/rainlab/blog/components/posts/default.htm
  • plugins/rainlab/blog/components/categories/default.htm

Note: the alias of the component referenced on the pages is is blogPosts (which i believe is the default)

Last updated

axomat
axomat

You should put the override files in places such as

themes/mythemename/partials/uniqueAlias/default.htm

Do not add the extra level (for example /posts/). As long as your component alias name is unique you will be fine.

daveharrison5796
daveharrison5796

@axomat. Thanks for chipping in. I actually updated my last post when i figured that out!, but it didn't get shown for some reason. Anyway thats that issue sorted , so no more loosing edited partials YAY!

I was also wondering if the blog component has anyway to show "next post" and "previous post" on the single blog post page or indeed if there is a way to add this without editing the core plugin files?

d.negativa
d.negativa

daveharrison5796 said:

I was also wondering if the blog component has anyway to show "next post" and "previous post" on the single blog post page or indeed if there is a way to add this without editing the core plugin files?

+1

1-7 of 7

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