EE: Title plugin
This ExpressionEngine plugin lets you retrieve an entry title quickly and effectively. This post now provides a place for support for the Low Title plugin.
Download and docs for Low Title can be found in the Software section
This ExpressionEngine plugin lets you retrieve an entry title quickly and effectively. This post now provides a place for support for the Low Title plugin.
Download and docs for Low Title can be found in the Software section
Comments
Will this plugin allow one to enter static <title> tags? I mean, if I have an About Us page I want the title to be very custom for SEO purposes. ie: <title>New York Travel, Vacation in NY, Attend a Broadway Show</title>.
JMB, this plugin will fetch 1 field from the database, from an entry, category, weblog or site. It will not add any html-tags, including <title> tags.
You could add a custom field like ‘SEO title’ to your weblog and use that as the page <title>. But if you’re after titles for static pages, why not just hard code them in the templates? Example:
<title>{if segment_1 == "about-us"}New York Travel, Vacation in NY, Attend a Broadway Show{/if}</title></pre>Hi Low,
This looks great. I’m assuming the biggest advantage of this would be to cut down on the resources used to get the same info via weblog:entries. Is that correct?
That’s correct, Jonas. Plus, it’s a lot less to type in.
Just realized that this won’t work…
{exp:title:category url_title='{segment_4}' custom_field="category_description"}…because “category_description” is a default field for categories, not a custom field. So, it seems that to do what I really wanted, I would need to create a custom category field and duplicate the information already contained in my category_description field. No?
You’re absolutely right, Richard. That should be the way to go.
I’m new to EE, and found this plugin to be quite promising. One issue though, I’m having difficulty getting the plugin to use the category and/or entry specific to the page that is loaded.
Here’s my code:
<title>
{exp:title:entry} | {exp:title:category} | {exp:title:site}
</title>
</pre>
What I would like to happen is that the title attribute will be rendered as the unique entry title, then the category the title is in, and finally the site name.
Entry Title First | Category Second | Site Name Last
With my current code, I’m getting the same title for the home page as my one other existing page.
Any thoughts on what I am doing wrong? Thanks.
Hi Matt. You have to tell the plugin which title to fetch. It doesn’t do that automatically, so you’ll probably have to use some kind of url structure to get the information you need.
A typical EE url can look like this:
domain.com/index.php/blog/comments/my-first-postwhereblogis your template group,commentsis your template, andmy-first-postis the url_title for a post. With this, you could use{exp:title:entry url_title="{segment_3}"}to get the title for the blog post.Instead of
{exp:title:site}(which is only really useful if you’re using the MSM), you might as well use the global variable{site_name}. That’ll save you one query.Getting the right category title, however, requires a bit more thought. You might want to add the category to your url structure, like this:
domain.com/index.php/blog/comments/category/news/my-first-post, then you could use{exp:title:entry url_title="{segment_5}"} | {exp:title:category url_title="{segment_4}"}. You could also use a different approach and use the rEEposition plugin to construct your title…Thanks Low. That helps a lot. I’ll do some experimenting and see what I can do.
Hi Low,
Thanks for keeping this pluging updated and adding features. I am trying to use it on a multilingual website using Mark Huots language switcher but I am not sure how should the custom_field=”title_{language}”} work.
I turned on the show_error to see what’s wrong and it gives me “Custom field not found”. Is {language} a global EE variable. Seems not. And I don’t see it in the plugin being called. Anyway…
I tried to retrieve it with the cookie plugin: custom_field=”title{exp:cookie:retrieve name=”lang”}” no luck, seems like the order of parsing those values is a mismatch.
I just baffled how you use the custom_filed with the {language} in your plugin.
Thank you very much
Hi Stanislav. In my example
{language}is a global variable, set in (for example) your path.php file. I’m not familiar with Mark’s language switcher, and an EE-tag as a parameter value will not work… You should somehow try and set the global variable, so you can use it as input for this plugin.Oh I see, OK. I understand. Will try, thank you.
Hi,
nice Plugin! Does it work with the Forum-Module also?
Thanks,
Jörn
@Jörn, like all plugins, this only works in the regular EE templates.
Does this plugin work with the Pages module in ExpressionEngine?
I’m getting inconsistent results displaying the title of an Entry when used to create a “static” page with a URL like
/about/staff/.When I compare the following code samples they don’t result in the same output (though I believe they should):
{exp:title:entry weblog="default_site"}vs.{exp:weblog:entries weblog="default_site"}{title}{/exp:weblog:entries}From what I can determine, this plugin works only for “static” page titles in
{segment_1}but not titles contained in{segment_2}and beyond.Hi Ryan. This plugin isn’t dynamic. It’ll always need either an entry_id or url_title to get the right title.
It would be great if this plugin could output the entries page_uri/page_url as well. Might dig in and see what would be involved.
To anyone interested, I added the ability to use: {exp:title page_uri=”/about”} or {exp:title page_uri=”{segment_2}”} for the Pages module (or Structure).
Low - If you want to add it to GitHub I can fork it.
Tim, could you send me your version, please? I’ll see if I can integrate it into mine.
Another idea!
It would be nice to have an option to fall back to the title field if the custom field you specify is empty.
Hi Low, thanks for this plugin, i’ve just starting using/testing it with my first EE2 PB install.
Just wondering if it’s possible for it to pull in the ‘last segment’ at all?
I’d love a title like this: <title>Site Label - Last Segment</title>
Thanks,
Stephen
Let this be a lesson to me: ALWAYS check for a plugin from Low before I go all custom coding shit all the time. :: facepalm ::
Lovely, Low. Now, kick me in the ass for re-inventing the wheel.
Is is possible to use variables other than {segment_2},{segment_3}, etc. in “url_title=”{segment_3}”? With a query I pulled a url_title as {r_url_title} but url_title=”{r_url_title}” ends up in a syntax error.
Joost, it should be possible. What’s the error you’re getting? Also, if you’re already using a query to get the url_title, why not get the title itself while you’re at it?
My purpose was to create navigational links (one level deeper from where I was) so I wasn’t on the page itself. I did find another solution to get this work with bypassing the use of the query module and the title plugin. Thanks anyway!
Downloaded the zip, it contains 2.0 version, do you have the 1x version available anywhere, plugin seems perfect for my needs. thanks!
jf, there are 2 download links on the software page. The top one contains version 1.1, compatible with EE 1.x.
:) Oh I see, I had both version in my download folder and kept opening the 2.0 version. I guess it’s time to take a break.
Really like your plugin, needed MultiSite Manage support. Putting it in was super simple. You can checkout my modified version here: http://www.samoltz.com/drop/pi.title.php.zip
Hi Low,
Further to my request for a ‘last segment’ parameter above, I’ve just managed to get this working in conjunction with the Last Segment addon by Bjorn Borresen.
{exp:low_title:entry url_title=”{segment_{last_segment_id}}”} - {last_segment_id}
Don’t get me wrong, I’d rather accomplish this with just a single addon, but it works and it’s a better solution than what I’d be able to do myself ! :-)
Thanks,
Stephen
Hey Stephen,
You’re right, that’s one way of getting to the last segment. Or you could use the method I described here to get {last_segment} as a global variable, and use that as your input.