How to build dynamic meta tags

Ryan Kent

Well-known member
In the PAGE_CONTAINER template I added the following line of code:

Code:
<meta name="keywords" content="Tera, Tera online, Tera pvp, play Tera, Tera USA, Tera Europe, Tera wiki">

Google WMT noticed this code is on many pages, and I presume they are discounting those tags, as they probably should.

What I would like to do is build a dynamic tag based on the page nodes. Let's assume I had a forum that talked about cars. Category: New Cars, Forum: Chevrolet, Sub-forum: Corvette. The code should automatically determine how many levels deep in which a thread exists.

How can I build a dynamic tag such that meta name = category_node, forum_node, sub-forum_node? The output should be meta name = New Cars, Chevrolet, Corvette.

This system would be great in that it would accurately provide the proper meta tags. It would be good SEO for forum owners, and from Google's perspective as well.
 
It's not worth the trouble. Meta keywords aren't used by search engines anymore.

Having said that, here is some ugly hackish code that you can use in PAGE_CONTAINER to build a comma-list of node names like you want:

Code:
<xen:foreach loop="$navigation" value="$breadcrumb">{xen:raw $breadcrumb.value}, </xen:foreach>{xen:raw $title}

You can stick it in the keywords like so:

Code:
<meta name="keywords" content="<xen:foreach loop="$navigation" value="$breadcrumb">{xen:raw $breadcrumb.value}, </xen:foreach>{xen:raw $title}" />
 
Jake, one additional question on the code you shared.

It works great but it doesn't include the "Forums" tag as part of the breadcrumb. I like how it skips "Home" but would like it to include "Forums". Looking at the code I don't see an obvious way to bump it one level higher to include it.

I realize that the SEO benefit is minimal but I ask for my own learning of XF coding as well.
 
It works great but it doesn't include the "Forums" tag as part of the breadcrumb. I like how it skips "Home" but would like it to include "Forums". Looking at the code I don't see an obvious way to bump it one level higher to include it.

"Forums" would always be the same. You can just slap it on the beginning, hard-coded.

Code:
<meta name="keywords" content="Forums, <xen:foreach loop="$navigation" value="$breadcrumb">{xen:raw $breadcrumb.value}, </xen:foreach>{xen:raw $title}" />
 
Actually on my site Forums is not always the same. I use this code on my whole site, and it always starts 1 node after I want it to.

On my Wiki pages it misses "Wiki", on Blog pages it misses "blog", etc.
 
I feel dirty doing this.

Code:
<meta name="keywords" content="{$selectedTab.title}, <xen:foreach loop="$navigation" value="$breadcrumb">{xen:raw $breadcrumb.value}, </xen:foreach>{xen:raw $title}" />
 
The last 10 seconds of the video says it all. "At least for Google, we don't use [meta keywords] even the least little bit".

When I posted this thread, I did not know this information. When Jake replied the first time, I believed him 100%. I recognize Jake as an expert, I know he would never share bad information on such an important subject.

Call it OCD but I really like to finish projects, and to do so the right way. I continued learning about the XF template syntax right up to the end. I will look for other places to use this information.

Right now, I have an issue where my forum threads rank well, but my wiki pages do not. I need to figure out a way to get keywords into wiki pages as tags, and this system may help.

Thanks Brogan, Brett and Jake for the information. It is all helpful.
 
Yes, Jake does some awesome work around here indeed.
I am unsure if Brogans post was referring to me.. But I shared the video for its information and not to deter Oracle from his quest :)
 
I decided to take Anthony's advice and sign up @ SEOmoz. For those not familiar with SEOmoz, I would describe them as a high-end SEO educational group.

They took the keyword meta tag suggestion a step further by sharing the opinion the tag should be removed. A recent analysis of my site offered the following feedback:
Avoid Using Meta Keywords Tag

Easy fix
Keywords tag
"TERA "
Explanation
Search engines have, for years, ignored the meta keywords tag as a ranking signal. Although it technically does not harm rankings, it can be used by competitors as a method to extract your targeted terms and thus, we recommend against its use.
Recommendation
Remove the meta keywords tag.
 
I found a positive use for the dynamic meta-tag code --> dynamic meta description tags :)

The wiki add-on Jaxel created currently uses the board description as the description on every wiki page. It's bad because Google recognizes that all the pages use the same meta description and I presume they ignore it.

I have two options. I can emulate the process used on forum pages and grab the first ?75 characters of text. The problem is many pages begin with an image so just the attachment id shows. An alternative is to use the dynamic breadcrumb info.

This code works in the PAGE_CONTAINER, but not in the add-on's template. I presume some variables are visible to the PAGE_CONTAINER template that are not visible everywhere? Is it simply a matter of including another template to access the values?

Code:
 <xen:container var="$head.description"><meta name="description" content="TERA, {$selectedTab.title}, <xen:foreach loop="$navigation" value="$breadcrumb">{xen:raw $breadcrumb.value}, </xen:foreach>{xen:raw $title}" /></xen:container>
 
Is that XenCarta?

I just installed that addon to test this. You can use this code in the EWRcarta_PageView template:

Code:
<xen:container var="$head.description"><meta name="description" content="Wiki, <xen:foreach loop="$breadCrumbs" value="$breadcrumb">{xen:raw $breadcrumb.value}, </xen:foreach>{$page.page_name}" /></xen:container>

XenCarta defines $breadCrumbs in the controller which you can use in a foreach.
 
Amazing, thank you.

So if you can stand me for a few more questions, I am at a point where I desire to understand how things work.

foreach loop="$navigation"....navigation represents what? a field in a table? a declared variable?

and when you say $breadCrumbs is defined in the XenCarta controller, is that the requirement to access the information? A template can only access information which has been predefined in a controller?
 
foreach loop="$navigation"....navigation represents what? a field in a table? a declared variable?

$navigation is an array containing the breadcrumb information. The foreach loop parses through the array.

and when you say $breadCrumbs is defined in the XenCarta controller, is that the requirement to access the information? A template can only access information which has been predefined in a controller?

See this thread:

http://xenforo.com/community/threads/1-0-0-b1-finding-variables-available-to-templates.6071/
 
I also agree.
The most important factors are content, title, link back and pagerank.
Content is still the most important.

We should use time to help people in my forum and make great contents for everyone.
 
Top Bottom