Dynamic Page Titles FW/EE

Anyone experienced setting up for dynamic page titles using Freeway and EE?

In short. How can I add the EE tag to my Freeway doc so that the site shows page titles dynamically.

Rob


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You’d have to get this action and apply it to your page that you want to have the ‘dynamic title’:

http://actionsforge.com/projects/view/28-dynamic-page-titles

Then in your FW document you’d have your existing page title, so for example we’ll call it:

Example.com | Articles | (Then you want to have the future article name here)

To do dynamic titles then you’d have to use the weblog entries tag so it’d look like:

Example.com | Articles | {exp:weblog:entries}{title}{/exp:weblog:entries}

Typically how I do these is by using the global variable of ‘{site_name}’ and then adding it so on my FW pages it looks like:

{site_name} | Articles | {exp:weblog:entries}{title}{/exp:weblog:entries}

which turns into:

Example.com | Articles | Article Title

What the action does is prevent FW from messing up the curly brackets and what not.

Hopefully that helps.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I think this only works on a single entry page. Please correct me if I’m wrong.
Also a good habit is to use things like disable=“categories|category_fields|member_data|trackbacks” in the tag, in order to decrease serverload.
BTW I did not use the action, but I paste the tag in the name field of the page (in the Inspector) Works fine.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

True, it would typically be used for a single entry page, however it can be done otherwise, but I doubt he’d want to do that.

I don’t think it’d be a considerable server load if he left the ‘disable’ parameters out, since it’s just a title being pulled from the db. When I try and use the title part without the action, I get mixed results, so I just apply it every time.

Also, if he were to add the ‘disable’ then FW would convert the ‘quotation’ marks to the HTML equivalent which would not produce the correct results.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Strange enough my quotationmarks escape as ~~& q u o t ; ~~ (which are also in the weblog= part not only in the disable part), so I can put my tag straight into the title field of the page.

Did not know about how much extra serverload, just wanted to make EE as efficient as possible.

And one caveat with these dynamic titles.

If your typical url would be mydomain/index.php/my_templategroup/my_single_entry_template and you would call for mydomain/index.php/my_templategroup/ one would get a page with the latest entry (obvious) but all the titles as pagetitle. Google calls this incomplete URL. If your site has many entrys you would end up there with a too long pagetitle.
One can avoid that by adding ~~{if segment_3==“”}
{redirect=“404”}{/if}
~~ before the <!DOCTYPE (only works with build 1.6.8) and setting for strict URLs to yes. ( http://expressionengine.com/docs/cp/templates/global_template_preferences.html ) or add require_entry=yes in your tag, but I did not get that working. ( http://expressionengine.com/docs/modules/weblog/parameters.html )
Or maybe with some clever rule in the robot.txt file, I do not know.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Something went wrong while posting, sorry. The URL (above) leads to another methode, to use require_entry=“yes” and the conditional, but I have not succeeded yet to make that work.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Dan,

Thanks for the advice. It all works fine now.

Rob


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

@RobP - Glad you got it working.

@atelier - That’s an interesting thought. I don’t know how a URL would get misconstrued in the hyperlink, unless it was human error somehow and you would want to have planned for everything so why not force a URL to be present or else go somewhere else.

So your code would look like:

{if segment_3 == ""}{redirect="404"}{/if}

The URL for future reference is here:

http://expressionengine.com/docs/modules/weblog/conditional_variables.html#cond_if_no_results

That’s interesting, I’m going to add that to my pages now on my site.

Thanks for the tip.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Dan

Your’re welcome.
I noticed this because I saw a rapport from Google with warnings that some pagetitles were too long.

Code is like that, correct. Presuming that segment 3 equals the title of the entree. Depends on how the URL is build up, naturally. These segments combined with conditionals are quite powerful.

BTW I use an equal amount of ~ in my posts in order to format my code snippets nicely, but somehow the formatting fails here or do I things wrong??


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

FreewayTalk uses Michel Fortin’s excellent PHP Markdown Extra
formatter, a PHP port (with extras) of the Markdown language by John
Gruber. I have further extended this formatter to meet the needs of
more Freeway-centric stuff like pasting Action code into the mix, or
hiding e-mail addresses, or converting older PHPBB links to the new
format.

Code formatting works like this:

four tildes on one line

your code on as many lines following that as you need

four tildes on one line

here’s an example:

<script type="javascript">
	for (foo in bar){
		console.log(bar);
	}
</script>

If you just want to slip one or two words of code into an otherwise
normal sentence, use back-ticks (the lower-case of the tilde on US
English keyboards, your mileage may vary in other parts of the world).
The back-ticks MUST touch the word or phrase on either side, you may
not have a space “insulating” the back-tick from the text it is
supposed to modify)

So that would look like this: here is an explanation of the baz()
operator you may have seen from time to time in code examples.

Walter

On Nov 20, 2009, at 10:27 AM, atelier wrote:

Hi Dan

Your’re welcome.
I noticed this because I saw a rapport from Google with warnings
that some pagetitles were too long.

Code is like that, correct. Presuming that segment 3 equals the
title of the entree. Depends on how the URL is build up, naturally.
These segments combined with conditionals are quite powerful.

BTW I use an equal amount of ~ in my posts in order to format my
code snippets nicely, but somehow the formatting fails here or do I
things wrong??


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Ah, thank you Walter.
I searched fot ‘formatting code’ (or something like that) here and found an answer that mentioned ‘an equal amount of’ tildes. So that’s what I did in my first post, but I forgot to add ‘enter’ after the tildes.

code

Now it works, swell!
May I make a feature request? Can you please write something on this in the ‘about’ section? I tend to forget… sorry ;-(


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options