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.

dynamic keywords, title, run amok.

November 26, 2007 3:32am

Subscribe [2]
  • #1 / Nov 26, 2007 3:32am

    Cathie

    29 posts

    I’m sorry for the lousy title but….
    I am happy that google is finally indexing some pages but this is a page that I found with a google search.  I was a little surprised at what I saw.
    Please check this link.
    http://www.4fashionadvice.com/index.php?/index3/P97/
    Notice that all the http://www.4fashionadvice.com/index.php?/index3/
    do the same thing.

    What it should look like is this:

    http://www.4fashionadvice.com/index.php?/4fashionadvice/index3/november_style_notes_2007/

    It seems that if a specific blog entry is not specified, all the blog entry keywords are displayed at the top of the page.

    I have put the head information for “index3” below.  What I am trying to do is display the keywords and titles dynamically.  Thank you.

    <head>
    <title>{exp:weblog:info weblog="name-of-weblog-here"}
      {blog_title}
    {/exp:weblog:info}  {exp:weblog:entries}
      {htmltitle} </title>
    {exp:weblog:entries weblog="stylenotes" url_title="{segment_3}” limit=“1” rdf=“off” disable=“categories|member_data|pagination|trackbacks”}
    {if keywords}
      <meta NAME=“keywords” content=”{keywords} Free Fashion Advice, Fashion tips, Fashion consultants, Fashion Designer, fashion Trends, Women’s, San Francisco, Paris, New York, Milan” />
    {if:else}
      <meta NAME=“keywords” content=“Fashion Advice, Fashion tips, Fashion consultants, Free Fashion Advice, Free fashion guide, Fashion newsletters,  Fashion Shows, fashion 2006, Beauty tips, Fashion Expert, Fashion Designer, fashion Trends, Women’s, Fashion Guide, image consulting Fashion Style Advice Designer Trends Expert San Francisco Paris New York Milan” />
    {/if}
    {/exp:weblog:entries}

    {exp:weblog:entries weblog="stylenotes" url_title="{segment_3}” limit=“1” rdf=“off” disable=“categories|member_data|pagination|trackbacks”}
    {if Meta_Data}
      <meta NAME=“description” content=”{Meta_Data}, 4FashionAdvice what to wear, what not to wear. Great tips and trends for success! Fashion and other essential elements, such as beauty and health. steps for success” />
    {if:else}
      <meta NAME=“description” content=“4FashionAdvice.com what to wear / what not to wear. Great tips and trends for success! Fashion and other essential elements, such as beauty and health. steps for success” />
    {/if}
    {/exp:weblog:entries}

    {exp:weblog:entries weblog="stylenotes" url_title="{segment_3}” limit=“1” rdf=“off” disable=“categories|member_data|pagination|trackbacks”}
    {if topic}
      <meta NAME=“page-topic” content=”{topic}, 4FashionAdvice.com what to wear, what not to wear. Great tips and trends for success! Fashion and other essential elements, such as beauty and health. steps for success” />
    {if:else}
      <meta NAME=“page-topic” content=“4FashionAdvice.com what to wear / what not to wear. Great tips and trends for success! Fashion and other essential elements, such as beauty and health. steps for success” />
    {/if}
    {/exp:weblog:entries}

    {exp:weblog:entries weblog="stylenotes" url_title="{segment_3}” limit=“1” rdf=“off” disable=“categories|member_data|pagination|trackbacks”}
    {if keywords}
      <meta NAME=“robots” content=”{keywords} Free Fashion Advice, Fashion tips, Fashion consultants, Fashion Designer, fashion Trends, Women’s, San Francisco, Paris, New York, Milan” />
    {if:else}
      <meta NAME=“robots” content=“Fashion Advice, Fashion tips, Fashion consultants, Free Fashion Advice, Free fashion guide, Fashion newsletters,  Fashion Shows, fashion 2006, Beauty tips, Fashion Expert, Fashion Designer, fashion Trends, Women’s, Fashion Guide, image consulting Fashion Style Advice Designer Trends Expert San Francisco Paris New York Milan” />
    {/if}
    {/exp:weblog:entries}

    {exp:weblog:entries weblog="stylenotes" url_title="{segment_3}” limit=“1” rdf=“off” disable=“categories|member_data|pagination|trackbacks”}
    {if topic}
      <meta NAME=“classification” content=”{topic} fashion,designer, women’s, style, online, tips, trends, news, beauty,  style, wardrobe, skin care,design,books” />
    {if:else}
      <meta NAME=“classification” content=“Fashion Advice, Fashion tips, Fashion consultants, Free Fashion Advice, Free fashion guide, Fashion newsletters,  Fashion Shows, fashion 2006, Beauty tips, Fashion Expert, Fashion Designer, fashion Trends, Women’s, Fashion Guide, image consulting Fashion Style Advice Designer Trends Expert San Francisco Paris New York Milan” />
    {/if}
    {/exp:weblog:entries}
    <meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1” />
    <meta name=“MSSmartTagsPreventParsing” content=“false”>
    <meta name=“author” content=“Cathie Hehman”>
    <meta name=“copyright” content=“Copyright (c)2006 Cathie Hehman, distributed by 4fashionadvice.com. All rights reserved.”>
    <meta name=“language” content=“en-us”>
    <head>

  • #2 / Nov 26, 2007 6:23am

    allgood2

    427 posts

    From what I can see, your not opening and closing things properly. Just look at the <title> segment code. Your code looks like:

    <head> 
    <title>{exp:weblog:info weblog="name-of-weblog-here"} 
    {blog_title} 
    {/exp:weblog:info} {exp:weblog:entries} 
    {htmltitle} </title>

    But you’ve opened two EE tags, and have only closed one of them.  By rights the code should look like

    <head> 
    <title>{exp:weblog:info weblog="name-of-weblog-here"}{blog_title}{/exp:weblog:info} | {exp:weblog:entries weblog="name-of-weblog-here"}{htmltitle}{/exp:weblog:entries}</title>

    That said, there really should be a other information included as well,  things like ‘limit’, ‘disable’, etc.  From what I can tell, your pulling data from all records in the weblog, instead of just the current record. Adding the parameter, limit=‘1’ to your {exp:weblog:entries} tag would help there.  If you view source on the page you gave, you’ll see that its pulling over 25 article titles (I stopped counting). Each title has a stray </title> and the associated meta data for keywords. It’s the stacked keyword metadata that you are viewing.

    Why don’t you try something like

    [code]
    <head>
    
    <title>{exp:weblog:info weblog="name-of-weblog-here"}{blog_title}{/exp:weblog:info} | {exp:weblog:entries weblog="name-of-weblog-here" limit="1" rdf="off" disable="categories|member_data|pagination|trackbacks"}{htmltitle}{/exp:weblog:entries}</title> 
    
    {exp:weblog:entries weblog="stylenotes" url_title="{segment_3}" limit="1" rdf="off" disable="categories|member_data|pagination|trackbacks"} 
    
    {if keywords !=""} 
     <meta NAME="keywords" content="{keywords} Free Fashion Advice, Fashion tips, Fashion consultants, Fashion Designer, fashion Trends, Women's, San Francisco, Paris, New York, Milan" /> 
    
    {if:else} 
    
     <meta NAME="keywords" content="Fashion Advice, Fashion tips, Fashion consultants, Free Fashion Advice, Free fashion guide, Fashion newsletters, Fashion Shows, fashion 2006, Beauty tips, Fashion Expert, Fashion Designer, fashion Trends, Women's, Fashion Guide, image consulting Fashion Style Advice Designer Trends Expert San Francisco Paris New York Milan" /> 
    {/if} 
    
    {if Meta_Data !=""} 
     <meta NAME="description" content="{Meta_Data}, 4FashionAdvice what to wear, what not to wear. Great tips and trends for success! Fashion and other essential elements, such as beauty and health. steps for success" /> 
    
    {if:else} 
    
     <meta NAME="description" content="4FashionAdvice.com what to wear / what not to wear. Great tips and trends for success! Fashion and other essential elements, such as beauty and health. steps for success" /> 
    {/if} 
    
    {/exp:weblog:entries}

    You can continue the various {if}{/if} statements within a single data pull (use of the {exp:weblog:entries} tag, instead of repeating continuously. Also, you could remove the {if statement, if you (1) place the field at the end of the list, instead of the beginning, or (2) enter in the data with a trailing comma. Your statement would then look like

    TRAILING COMMA IN FIELD

    <meta NAME="keywords" content="{keywords} Free Fashion Advice, Fashion tips, Fashion consultants, Fashion Designer, fashion Trends, Women's, San Francisco, Paris, New York, Milan" />

    or

    FIELD AT END OF STATEMENT

    <meta NAME="keywords" content="Free Fashion Advice, Fashion tips, Fashion consultants, Fashion Designer, fashion Trends, Women's, San Francisco, Paris, New York, Milan, {keywords} " />


    Either of those options, would remove the need for all those {if}{/if} statements.

  • #3 / Nov 26, 2007 10:31am

    Robin Sowell

    13255 posts

    I may shift this over to ‘How to’ as it’s a bit better fit.  I personally would rethink the above- using multiple weblog tags to achieve the above is seriously resource intentsive and I’m not sure why you’re doing it.  A single weblog tag with a limit=1 should do the trick.  But keep in mind, on a multi-entry page, it’s just going to pull the data from the latest entry that ‘fits’.  I generally use a unique main page- hard code my meta data.  A different multi-entry page, and then a unique single entry template.  But- that’s a matter of personal preference.

    Still- the problem boils down to- it shows the latest entry’s info- and since you have links to each ‘page’- the spiders will include them.  (Could do a noindex on them to prevent that.)

  • #4 / Nov 29, 2007 2:33am

    Cathie

    29 posts

    Thank you Robin and Allgood2.  Sorry for the delayed response.
    If I copy the code presented by allgood2, verbatim, the page does not display a title and the keywords are the default keywords, not based on blog entries.  As you can see by following the above link.
    I am not an experience coder so a little spoon feeding would be appreciated.
    I was instructed by an SEO authority to have my page titles and keywords displayed dynamically based on weblog content.
    What I am attempting to do is display the titles and keywords accordingly, but I am not sure how to go about it.  Could you give me some code that would accomplish this task or direct me to a URL with some help.  Maybe some examples of how others are accomplishing this task?
    I appreciate the help.
    Laura

  • #5 / Nov 29, 2007 6:16am

    allgood2

    427 posts

    You can’t copy my code verbatim, you’ll need to adapt it for your website. Plus, I gave you three different examples, which one did you use?

  • #6 / Dec 01, 2007 9:12pm

    Cathie

    29 posts

    Thanks allgood2,
    I did not see where to adapt the code for the website since I saw 4fashionadvice keywords, name of weblog, and such.  I mistakenly thought it was adapted for the 4fashionadvice.com
    I used the long code example that follows “Why don’t you try something like”.
    Could you identify which parts would be unique to my website?
    Thanks

  • #7 / Dec 03, 2007 11:33am

    allgood2

    427 posts

    Well primarily, you need to specify your weblog.  I just left in the {exp:weblog:info weblog="name-of-weblog-here"}  but the “name-of-weblog-here” should be replaced with the actual name of the weblog you are pulling data from.  I’ll go back through other components in a moment, a tech support call just came in.

  • #8 / Dec 03, 2007 12:05pm

    allgood2

    427 posts

    Sorry about that. Anyway, I pulled up your test pages while I was talking, and from what I can see, is that it looks like your keywords are now working fine, but your title tag is empty.  I would say this is because of two reasons: (1) The weblog is unspecified (my guess), and (2) the pages being pulled aren’t single article views.

    The first item is easy enough to fix, just specify the weblog: {exp:weblog:info weblog="name-of-weblog-here"}  might look something like {exp:weblog:info weblog="fashion"} . Obviously, I have no idea what the name of your weblogs are, so I can’t help you there.  Alternatively, if this will be a site prefix, then you could just type the information in, so

    <title>Fashion Advice | {exp:weblog:entries weblog="name-of-weblog-here" limit="1" rdf="off" disable="categories|member_data|pagination|trackbacks"}{htmltitle}{/exp:weblog:entries}</title>

    Now, the second issue, is a number of the pages you are pointing to, will not be single article pages—example index pages, etc.  These pages can’t really use the second part of the <title> tag. Since that assumes an individual article title would appear on the page.  You’ll want some {if} statements to handle that.  For example, we use

    <title>{exp:weblog:entries weblog="site" limit="1" rdf="off" disable="categories|member_data|pagination|trackbacks"}{if segment_2=="articles"}Site Name :: {title}{if:elseif segment_2=="details"}Site Name :: {title}{if:elseif segment_2 =="" AND segment_2 !="articles"}Site Name :: {exp:php_text_format type="ucwords"}{segment_1}{/exp:php_text_format}{if:else}Site Name{/if}{/exp:weblog:entries}</title>

    Which might be a little hard to follow, but basically, it checks to see if the page is an index or section page (multi-listing page), if so, it uses the section name to produce something like Site Name | Section Name or Fashion Site | Spring Fashion.  If the page is an actual article, then it displays the title as Site Name | Article Title or Fashion Site | Cashmere Makes a Comeback.  There is some code in there also for handling calendars, but that can be ignored.

  • #9 / Dec 05, 2007 4:26am

    Cathie

    29 posts

    Hi,
    Thank you Very Much allgood2.  I made the corrections and it fixed the title problem.
    <title>Fashion Advice | {exp:weblog:entries weblog="stylenotes" limit="1" rdf="off" disable="categories|member_data|pagination|trackbacks"}{htmltitle}{/exp:weblog:entries}</title>
    This works great and I am satisfied and appreciative of the help.

    When I tried to use the following code however, I got this error when viewing the website;

    Error

    The following tag has a syntax error:

    {exp:php_text_format}

    Please correct the syntax in your template.

    The code I used was:
    <title>{exp:weblog:entries weblog="stylenotes" limit="1" rdf="off" disable="categories|member_data|pagination|trackbacks"}{if segment_2=="articles"}Site Name :: {title}{if:elseif segment_2=="details"}Site Name :: {title}{if:elseif segment_2 =="" AND segment_2 !="articles"}Site Name :: {exp:php_text_format type="ucwords"}{segment_1}{/exp:php_text_format}{if:else}Site Name{/if}{/exp:weblog:entries}</title>

    Where “stylenotes” is the name of the weblog.

    While I am satisfied with the first solution, I am wondering if I have made an error in copying the code and if the first solution will suffice in all situations.

    Thanks again,  Cathie.

  • #10 / Dec 05, 2007 6:23am

    allgood2

    427 posts

    Nope, my bad. PHPTextFormat is a plug-in I use, so I can change the casing of weblog and category names. I like to always have them entered as lowercase, but typically want them to display as Title Case or some other format.  Just remove the opening {exp:php_text_format} and closing {/exp:php_text_format} tags.

  • #11 / Dec 11, 2007 3:51am

    Cathie

    29 posts

    Thank you for all your great help allgood2 and others.  It is greatly appreciated.
    I think this one is solved.

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

ExpressionEngine News!

#eecms, #events, #releases