Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Add custom code to homepage only


I cant seem to get my head around the templating system and how the views work in vanilla. I have a site with categories&discussions as homepage and I want to add some custom content after the header, but don't want it to show on other pages.

I have tried editing the master template, discussions view files and installing custom pages plugin. With custom pages plugin i couldn't get the categories and discussions and the sidebar to show.

Just don't get it.. I find the views very confusing. How do I add custom content to the homepage?

Best Answer


  • 422422 Developer MVP

    look at body id, :)

    so lets say the body id of index is id="vanilla_index" then you can target a css rule just for that id occurence.

  • Thanks for the fast reply.

    But I can't actually use a css hack like that. The code I'm about to include is some heavyweight php that the server cannot afford to run on every page load in vain.

Sign In or Register to comment.