We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

LG Better Meta and the Pages Module

Development and Programming

Marcus Hodges's avatar
Marcus Hodges
84 posts
16 years ago
Marcus Hodges's avatar Marcus Hodges

Hi. I have some entries that use the Pages Module to retain their old .html-based URL structure.

For example, the template/entry http://site.com/main/entry becomes http://site.com/main/entry.html through use of the Pages Module.

I want to be able to use LG Better Meta on these pages, but can’t figure out the syntax. I can use the following tag to show the page before the Pages Module puts its stamp on it, but that’s not the link people are going to be calling as it isn’t referenced in the site anywhere.

{exp:lg_better_meta_pl:template url_title="{segment_2}"}

When the URL is http://site.com/main/entry, I get the results of the LG Better Meta plugin doing its magic. When the URL is http://site.com/main/entry.html, I do not.

Can anyone help me figure out how to resolve this?

       
Marcus Hodges's avatar
Marcus Hodges
84 posts
16 years ago
Marcus Hodges's avatar Marcus Hodges

Can anyone suggest a more appropriate place to ask questions like this? I can never seem to get an answer from within this forum, but don’t want to put things in the wrong categories.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
16 years ago
Lisa Wess's avatar Lisa Wess

You might try emailing the author if you’re not getting a response in the forums.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

Hi Marcus,

That’s an interesting problem. I would recommend using a weblog:entries tag to grab the entry_id and pass that to the extension directly. If you have caching turned on and disable all of the params it will be a pretty light weight call.

I personally wrap the main portion of a single entry page in single weblog:entries tag. The page will break if the entry is not found becuase the header won’t be included. This isn’t really a concern when you use require_entry = “yes” and {if no_results}. I’ve added an example below of a fairly simple and standard blog post.

You’ll also notice that I’m setting the “meta_title_suffix” param which adds a little more SEO to the title.

{assign_variable:this_page_weblog="blog"}

{exp:weblog:entries
    cache="yes"
    disable="category_fields|member_data|pagination|trackbacks"
    dynamic="off"
    limit="1"
    refresh="10"
    require_entry="yes"
    rdf="off"
    status="not closed|Pending"
    weblog="{this_page_weblog}"
    url_title="{segment_3}"
}

    {if no_results || segment_2 != "post"}{redirect="404"}{/if}

    {embed="_includes/.head"
        entry_id="{entry_id}"
        meta_title_suffix="{blog_title}"
    }

    <div id="content">
        <div class="copy">
            <h1 class="page-title">{title}</h1>
            
                {entry_date format="%d:%m:%Y"} | 
                {categories}<a href="/blog/category-archive/#cat-{category_url_title}">{category_name}</a> + {/categories}
            
            {blog_body}
        </div>
    </div>

{embed="_includes/.foot"}

{/exp:weblog:entries}
       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

A quick follow up. If you need to include other {exp:weblog:entries} tags on the page you can unbalance the first {exp:weblog:entries} tag like so:

cache="yes"
    disable="category_fields|member_data|pagination|trackbacks"
    dynamic="off"
    limit="1"
    refresh="10"
    require_entry="yes"
    rdf="off"
    status="not closed|Pending"
    weblog="{this_page_weblog}"
    url_title="{segment_3}"
}

    {if no_results || segment_2 != "post"}{redirect="404"}{/if}

    {embed="_includes/.head"
        entry_id="{entry_id}"
        meta_title_suffix="{blog_title}"
    }

    <div id="content">
        <div class="copy">
            <h1 class="page-title">{title}</h1>
            
                {entry_date format="%d:%m:%Y"} | 
                {categories}<a href="/blog/category-archive/#cat-{category_url_title}">{category_name}</a> + {/categories}
            
            {blog_body}
        </div>
    </div>
{/exp:weblog:entries}
<ol>
{exp:weblog:entries weblog='some_other_blog' dynamic='off'}
    <li>{title}</li>
{/exp:weblog:entries}
</ol?>
{embed="_includes/.foot"}

</code></pre>

Again you’re guaranteeing an entry so the unbalanced tags don’t really matter.

       
Marcus Hodges's avatar
Marcus Hodges
84 posts
16 years ago
Marcus Hodges's avatar Marcus Hodges

What code do you have living inside the _includes/.head template? That might get me a little closer to understanding. Thanks much.

Marcus

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

checkout the section on embedding headers in the howto section: http://leevigraham.com/cms-customisation/expressionengine/lg-better-meta/

       
Marcus Hodges's avatar
Marcus Hodges
84 posts
16 years ago
Marcus Hodges's avatar Marcus Hodges

This is kind of above my head. I think we’ll just put our meta stuff in regular ol’ templates for now and call it a day.

       
kenny2's avatar
kenny2
90 posts
16 years ago
kenny2's avatar kenny2
You’ll also notice that I’m setting the “meta_title_suffix” param which adds a little more SEO to the title.

Leevi, should that just be “title_suffix” ? I cannot find “meta_title_suffix” in the embedded template

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.