Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Dear Couch-People,

i'm currently trying to find a way to inject a header for all the pages of my site - i have set up Couch for all pages, but i am currently making many small changes to the header and navigation bar and i don't want to repeatedly copypaste the new header to all pages.

I know that it is possible to embed snipptes with Couch, but the problem is:

The currently active navigation item has a specific class (class="active") so that it is highlighted in the nav-bar. Because of that, i would need the snippet to be dynamically changed for the currently active nav-bar item.

Is there a way to achieve this?

Thanks in advance :)

Kind regards

Sundance
You can use a cms:if to check on a condition like template name or title etc. I do that in one site I created recently.
Code: Select all
<li<cms:if k_template_name="delivery.php"> class="is-active"</cms:if>>
Guess that is what i am looking for :)

I put this code right into the snippet at the point where the class should be appended?

Thank you :)
And one more question:

Does this influence SEO or the way the page is indexed in any way? Or does the embed shortcode insert everything before?

Thank you
1. Yes put the code right where it is needed, another example;

Code: Select all
<li><a href="delivery.php" class="link <cms:if k_template_name="delivery.php">active</cms:if>">Delivery</a></li>


2. snippets are added to templates server side, so browsers and bots see the complete page as one entity.
Perfect - all questions answered :)

Thank you so much, fuffle!

Kind regards

Sundance
6 posts Page 1 of 1
cron