Forum Discussion

Kev_B's avatar
Kev_B
Advisor
8 years ago

Active class on navigation / changing blog page for a secondary blog

Hi,

 

Apologies for combining two questions into one post, but here goes:

 

  • We recently used the blog structure to create a secondary blog, this has now been incorporated into our site but in the navigation the active class is defined by:
    ${(page.interactionStyle == 'blog')?string("active", "")}
    Unfortunately with both 'blogs' in the navigation this is giving both an active class when on either of the blog pages. Does anybody know how to make this more specific to a particular blog?
  • How do we set the new blog to have a different 'Blog Article Page' to the main blog? I'm able to create the component, but not sure how to tell that blog to look for a specific page other than the default.

 

Any help / advice appreciated.

 

Kev

  • Just to add to my navigation problems:

     

    I've tried targeting the ${page.name} to set class=active, but unfortunately my existing blog page and the newly created blog both share the page.name of BlogPage, I've looked through the FreeMarker Context Objects and can't find anything else to utilise in order to set the class active to the current page only.

     

    Does anybody have any suggestions for a workaround? I'm considering writing some JavaScript to set the active classes on nav link, but read somewhere that JavaScript shouldn't be used in the head of the page, which is where our navigation is contained. Does anybody have any pointers on this?