I have been trying to wrap my head around how to use the LG Better Meta extension with embedded headers.
To start, here is what I have in my header:
{exp:lg_better_meta_pi:template
entry_id="{embed:entry_id}"
weblog_id="{embed:weblog_id}"
url_title="{embed:url_title}"
title="{embed:title}"
title_suffix="{embed:title_suffix}"
title_prefix="{embed:title_prefix}"
hide_site_title="{embed:hide_site_title}"
description="{embed:description}"
keywords="{embed:keywords}"
author="{embed:author}"
publisher="{embed:publisher}"
rights="{embed:rights}"
date_created="{embed:date_created}"
date_modified="{embed:date_modified}"
date_valid="{embed:date_valid}"
identifier="{embed:identifier}"
robots_index="{embed:robots_index}"
robots_follow="{embed:robots_follow}"
robots_archive="{embed:robots_archive}"
}
and here is what I have from the template that is calling the header:
{embed="inc/html-header" entry_id="{segment_3}" title="{url_title}"}
So, obviously my page header now shows exactly what my url_title is (as it should). The only issue with that is now I have a title that has
my-url-header - site title
What I would really like is to have the title that I put in the Meta Title field of the Better Meta tab of the publish form. Then I would like to have the description and keywords also populated by the Better Meta plugin.
The only thing I can think of is to wrap the embed tag with an entries tag to assign the embedded variables. No problem, but I don’t know the names of the Better Meta plugin variables.
I have to be missing something SOMEWHERE. I checked and the plugin is installed and the extension is installed and obviously turned on.
Please help?
How do you have your site structured? that seems awfully complicated to trigger the better Meta tag on a weblog entry. I use the plugin as well, but I pull from specific weblogs by using the url_title like this. could you post your code that you use to navigate to your weblog entry?
{exp:lg_better_meta_pi:template url_title="{segment_2}"}
Thanks for the help, much appreciated!
So this is how I have the site structured, and if I am doing this wrong, let me know.
I have 2 includes for my header: an html_header for the doctype, meta tags, css and js functions. Then I have a body_header include that has the template header (masthead, menus, etc…)
Then I have the template file that is called by EE that has the page body, then the sidebar and footer includes. So my basic template looks like:
{embed="inc/_html-header" entry_id="{segment_3}" title="{title}" description="{excerp}"}
{embed="inc/_body-header"}
Page body
{embed="inc/_sidebar"}
{embed="inc/_body-footer"}
With the Better Meta plugin I have:
{exp:weblog:entries weblog="accommodations" disable="trackbacks|pagination|member_data" url_title="{segment_3}"}
{embed="inc/_html-header" entry_id="{segment_3}" title="{title}" description="{dont_know}"}
{/exp}
{embed="inc/_body-header"}
Am I not structuring things correctly to have the dynamic meta (mainly concerned about the <title> and meta description) tags assigned by Better Meta? Should I pull the html_header (with the meta tags) and just put it in the main template?
This is my first EE site, so any help is appreciated.
Okay, First you need to pass the variable to the embed, which you are doing, but you also need to accept the variable that was passed like this:
{exp:weblog:entries weblog="accommodations" disable="trackbacks|pagination|member_data" url_title="{embed:segment_3}"}
Next how are you structuring the call to that page. Does your link look like this:
{path='template_group/template'}
If so, you should use either the {url_title_path} or {title_permalink="weblog/archives"} this will add the url_title in the URL which will trigger the correct better Meta from your weblog.
Also, just use this tag on your page:
{exp:lg_better_meta_pi:template url_title="{embed:segment_3}"}
And keep it simple. You do not need to add the whole tag like you are, just add the one line above and it will add all the meta data for you if you have those fields enabled for the weblog in the extension manager.
Hey Brian -
Thanks for all your hep on this. From what you said and from me stayig away from the computer from a bit, I was able to think about the problem a little.
I have since kind of restructured the way I’m doing my templates and using the Better Meta plugin to embed my html headers (doctype, css, js files, and meta) instead of including it through the embed. This seems to work much better.
Thanks again Kevin
Im having some problems getting the first post or parent page to display its meta information, so far i have this in my embedded html header
{exp:lg_better_meta_pi:template
entry_id="{embed:entry_id}"
weblog_id="{embed:weblog_id}"
url_title="{segment_2}"
title="{embed:title}"
title_suffix="{embed:title_suffix}"
title_prefix="{embed:title_prefix}"
hide_site_title="{embed:hide_site_title}"
description="{embed:description}"
keywords="{embed:keywords}"
author="{embed:author}"
publisher="{embed:publisher}"
rights="{embed:rights}"
date_created="{embed:date_created}"
date_modified="{embed:date_modified}"
date_valid="{embed:date_valid}"
identifier="{embed:identifier}"
robots_index="{embed:robots_index}"
robots_follow="{embed:robots_follow}"
robots_archive="{embed:robots_archive}"
}
so im able to get the meta information to show for the segment_2 pages, how do i get it to show for the parent page as well.
mysite.com/index.php/metanotshowing/metaisshowing/howdoyougetthismetashowing
Can i place a conditional in the url_title=”{segment_2}” segment? like segment_1 ,2 ,3 etc. if so how would that be written? sorry im a noob conditional statment guy lol
hopefully this makes sense and im not requesting too much 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.