ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to simplify header embeds with Better Meta

August 25, 2011 11:19am

Subscribe [1]
  • #1 / Aug 25, 2011 11:19am

    crossborders

    6 posts

    I am wondering what a better way there is to write the following code:

    {preload_replace:this_index_channel="case_study"}
    {preload_replace:disable_fields="categories|member_data|pagination"}
    
    {if segment_2 != ""}
    {exp:channel:entries channel="{this_index_channel}" disable="{disable_fields}" limit="1" status="not closed"}
    {embed="includes/document_head" url_title="{url_title}"}
    {/exp:channel:entries}
    {if:elseif segment_2 == ""}
    {embed="includes/document_head" title="Case Studies"}
    {/if}

    This is at the top of the index of a template group called “casestudies.” At the bottom of the page, I run the if/else statement again to embed the casestudy-view.html page which outputs the individual case-study entries. Also, I am using NSM Better Meta in my “document_head.html” file with the following code:

    {exp:nsm_better_meta:template}

    So far it works fine, but I feel like there could be a better way of writing this. Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases