Tag Meta is a Joomla native extension that allows you to efficiently manage site meta tags. Tag Meta allows to set the tag 'title' and the meta tags 'description', 'author', 'keywords' and 'robots' on each page, which is identified by the URL or a part of it. Also other meta information like the rel ‘canonical’ are supported, and there’s a customizable database of synonyms for each group of keywords, that can be used to enrich pages. This provides a powerful tool to improve site positioning in SEO optimization.
It was initially created because many Joomla extensions didn’t provide a way to set meta info on their pages, and in these cases Tag Meta helps you to do this. With the introduction of macros and placeholders that allow complex data manipulation now Tag Meta can be also used to improve site's SEO ranking and get some other advanced "things".
For best SEO results, remember to always use meaningful text for title and description, concerning content of the pages, and also remember to insert comma separated list of keywords (no spaces needed). Finally, it is recommended to enable native Joomla SEF routing to generate friendly URLs and simplify the site structure, improving both SERP positioning and meta info management.
Tag Meta package includes a component for managing list of rules for site's URLs, and a plugin that analyzes all requests and sets the meta information as defined by rules. These are the main steps to start using Tag Meta (for the impatient):
Detailed instructions on each step are described in the following paragraphs. In this section we just want to focus on some basic concepts related to Tag Meta and how it works.
The first important thing to understand is what a "rule" is. With Tag Meta Manager (the component interface) you can create as many items as you want, and each item is a meta info rule. But not necessarily an item corresponds to a single page (i.e. matches just a single URL).
A rule has a "URL" field that can be full URI or just a part of it. For example, if the "URL" field is "/home.html", then this rule matches both the URL http://www.mysite.com/home.html and http://www.mysite.com/orders/home.html?view=status. So, it means that with a single rule it is possible to match multiple source URLs. But the content of the "URL" field can be a regular expression, and this provide a powerful way to specify complex search patterns for matching URL. In the next paragraphs will be shown many regular expression examples.
For any request on the site, the Tag Meta plugin compares the requested URL with all the rules enabled. All matching rules are applied in the sequence defined with rules ordering. The "Last rule" flag controls if the current rule must be the last or not, so when multiple rules are applied the process ends if a rule has this field set to true. This provide a way to "pile" meta information from multiple rules for each page (e.g. some values come from the "category rule", other from the "single item rule").
Referring to an URL like the following:
Here is a list of supported macros for destination "To URL" field:
Macro | Description |
---|---|
URL macros | |
{siteurl} | Web site address
Example
www.example.com/path/to/Joomla |
{scheme} | URL scheme
Example
http |
{host} | URL host
Example
www.example.com |
{port} | URL port number
Example
8080 |
{user} | User name
Example
fredbloggs |
{pass} | User password
Example
itsasecret |
{path} | URL path
Example
/path/to/Joomla/section/cat/index.php |
{query} | URL query string
Example
task=view&id=32 |
{queryfull} | URL query string full (with question mark)
Example
?task=view&id=32 |
{querybuild var1=value1,...,varN=valueN} | Builds URL query containing only specified variables. If a value is specified for a variable, this is assigned to the variable
Example
{querybuild id,task} => id=32&task=view |
{querybuildfull var1=value1,...,varN=valueN} | Same as 'querybuild' but with question mark
Example
{querybuildfull id,task} => ?id=32&task=view |
{querybuildappend var1=value1,...,varN=valueN} | Same as 'querybuild' but with ampersand
Example
{querybuildappend id,task} => &id=32&task=view |
{querydrop var1=value1,...,varN=valueN} | Builds URL query removing specified variables from the original query. If a value is specified for a variable, this is assigned to the variable (that is not dropped) - ENTERPRISE VERSION ONLY
Example
{querydrop task} => id=32 |
{querydropfull var1=value1,...,varN=valueN} | Same as 'querydrop' but with question mark - ENTERPRISE VERSION ONLY
Example
{querydropfull task} => ?id=32 |
{querydropappend var1=value1,...,varN=valueN} | Same as 'querydrop' but with ampersand - ENTERPRISE VERSION ONLY
Example
{querydropappend task} => &id=32 |
{queryvar varname,default} | Returns the current value for the variable 'varname' of the URL, or the value 'default' if 'varname' is not defined (where default = '' when not specified)
Example
{queryvar task} => view |
{requestvar varname,default} | Returns the current value for the variable 'varname' of the request, no matter about method (GET, POST, ...), or the value 'default' if 'varname' is not defined (where default = '' when not specified)
Example
{requestvar id} => 32 |
{authority} | URL authority string
Example
fredbloggs:itsasecret@www.example.com:8080 |
{baseonly} | Returns the base path only (empty when installed on root, i.e. it will never contains a trailing slash)
Example
/path/to/Joomla |
{pathfrombase} | Returns the path without the base part
Example
/section/cat/index.php |
{pathltrim pathtotrim} | Strip the string specified (pathtotrim) from the beginning of the path and returns the result
Example
{pathltrim /path/to} => /Joomla/section/cat/index.php |
{pathrtrim pathtotrim} | Strip the string specified (pathtotrim) from the end of the path and returns the result
Example
{pathrtrim /index.php} => /path/to/Joomla/section/cat |
{pathfrombaseltrim pathtotrim} | Same as 'pathltrim' but works on path without the base part - ENTERPRISE VERSION ONLY
Example
{pathfrombaseltrim /section} => /cat/index.php |
{pathfrombasertrim pathtotrim} | Same as 'pathrtrim' but works on path without the base part - ENTERPRISE VERSION ONLY
Example
{pathfrombasertrim index.php} => /section/cat/ |
{preg_match N}pattern{/preg_match} | Returns the N-th matched pattern on the 'full source URL', where N = 0 when not specified - ENTERPRISE VERSION ONLY
Example
{preg_match}/([^\/]+)(\.php|\.html|\.htm)/i{/preg_match} => index.php |
{routeurl} | Returns the routed (relative) URL using all current variables
Example
/using-joomla.html |
{routeurl var1,var2,var3=myvalue,..,varN} | Returns the routed (relative) URL for specified variables
Example
index.php?var1=value1&var2=value2&var3=myvalue&..&varN=valueN |
{pathfolder N} | Returns the N-th folder of the URL path - ENTERPRISE VERSION ONLY
Example
{pathfolder 4} of /path/to/Joomla/section/cat/index.php => section |
{pathfolder last-N} | Returns the (last-N)-th folder of the URL path, where N = 0 when not specified - ENTERPRISE VERSION ONLY
Example
{pathfolder last-1} of /path/to/Joomla/section/cat/index.php => cat |
Site macros | |
{sitename} | Global site name
Example
Global $sitename configuration value |
{globaldescription} | Global site meta description
Example
Global $MetaDesc configuration value |
{globalkeywords} | Global site meta keywords
Example
Global $MetaKeys configuration value |
{username} | Returns the current username
Example
{username} => admin |
{username default} | Returns the current username or the value 'default' for guest users
Example
{username nobody} => nobody |
{userid} | Returns the current user ID
Example
{userid} => 62 |
{userid default} | Returns the current user ID or the value 'default' for guest users
Example
{username 1001} => 1001 |
Database macros | |
{tableselect table,column,key}value{/tableselect} | Returns result of a SQL query (SELECT column FROM table WHERE key = value). Support #__ notation for table name
Example
{tableselect #__users,username,id}135{/tableselect} => SELECT username FROM #__users WHERE id = 135 |
{preg_select table,column,key,N}pattern{/preg_select} | Same as 'preg_match' but uses the matched result to execute a SQL query (SELECT column FROM table WHERE key = matchN). Support #__ notation for table name - ENTERPRISE VERSION ONLY
Example
{preg_select #__content,title,id,1}/id=([0-9]+)/i{/preg_match} => SELECT title FROM #__content WHERE id = 32 |
{placeholder_select table,column,key1=placeholder1,..,keyN=placeholderN} | Returns result of a SQL query (SELECT column FROM table WHERE key1 = ${placeholder1} AND ... AND keyN = ${placeholderN}) where ${placeholderN} is the value of the placeholder with name placeholderN. Support #__ notation for table name. The 'placeholder' must be previously defined (just placeholder name needed, not ${} format) - ENTERPRISE VERSION ONLY
Example
userId=62 |
String macros | |
{substr start,length}text{/substr} | Returns the portion of string specified by the start and length parameters. String are zero-based (i.e. first char has index 0)
Example
{substr 1,3}Joomla{/substr} => oom |
{strip_tags}text{/strip_tags} | Strip HTML and PHP tags from the given string
Example
{strip_tags}<p>hello<br/>Joomla</p>{/strip_tags} => helloJoomla |
{extract N}text{/extract} | Returns the Nth sentence delimited with carriage return (DOS, UNIX or MAC format). All HTML tags stripped
Example
{extract 1}<p>This is a sentence.\nAnd this is another one.</p>{/extract} => This is a sentence. |
{extractp N}text{/extractp} | Returns the Nth HTML paragraph <p></p>. All HTML tags stripped
Example
{extractp 2}<p>First paragraph</p><p>Second paragraph</p><p>Third paragraph</p>{/extractp} => Second paragraph |
{extractdiv N}text{/extractdiv} | Returns the Nth HTML paragraph <div></div>. All HTML tags stripped
Example
{extractp 3}<div>First paragraph</div><div>Second paragraph</div><div>Third paragraph</div>{/extractp} => Third paragraph |
{preg_subject N,subject}pattern{/preg_subject} | Returns the N-th matched pattern on the 'subject', where N = 0 when not specified. The 'subject' can contain placeholders, but cannot contain standalone '}' chars - ENTERPRISE VERSION ONLY
Example
{preg_subject 2,First/Second/Third}/([^\/]+)\/([^\/]+)\/([^\/]+)/i{/preg_subject} => Second |
{preg_placeholder N,placeholder}pattern{/preg_placeholder} | Returns the N-th matched pattern on the 'placeholder' evaluated string, where N = 0 when not specified. The 'placeholder' must be previously defined (just placeholder name needed, not ${} format)
Example
a=First/Second/Third |
{lowercase}pattern{/lowercase} | Returns the pattern in lower case
Example
{lowercase}ALL to Lower{/lowercase} => all to lower |
{uppercase}pattern{/uppercase} | Returns the pattern in upper case
Example
{uppercase}ALL to UppeR{/uppercase} => ALL TO UPPER |
{urldecode}pattern{/urldecode} | Returns the decode pattern using urldecode() function
Example
{urldecode}%2Fgoto%20home%2F{/urldecode} => /goto home/ |
{urlencode}pattern{/urlencode} | Returns the encoded pattern using urlencode() function
Example
{urlencode}/encode me/{/urlencode} => %2Fencode%20me%2F |
{rawurldecode}pattern{/rawurldecode} | Returns the decode pattern using rawurldecode() function
Example
{rawurldecode}foo%20bar%40baz{/rawurldecode} => foo bar@baz |
{rawurlencode}pattern{/rawurlencode} | Returns the encoded pattern using rawurlencode() function
Example
{rawurlencode}foo @+%/{/rawurlencode} => foo%20%40%2B%25%2F |
{str_replace search,replace}pattern{/str_replace} | Returns the pattern after replacing 'search' with 'replace'
Example
{str_replace john,scott}my name is john{/str_replace} => my name is scott |
ReDJ is a Joomla native extension that allows to efficiently manage URL redirection. This is very useful for creating URL aliases, and managing redirects from an old URL to a new one. A very similar extension has been added into Joomla since version 1.6, but ReDJ supports powerful regular expressions that allow to match more than one source URL. In this way it is possible to create a group of redirects with just one ReDJ rule.
ReDJ also supports usage of "macros" in the destination URL. A macro is like a function whose value is calculated at runtime (when the rule matches an URL). There are a loto of macros available and this allows to create dynamic destinations, with a different redirection for each source URL. To increase flexibilty in the building of dynamic destinations, also "placeholders" are supported. A placeholder is like a variable whose value can be assigned using text, macros or other placeholders, and can be used to build the destination.
Another great ReDJ feature is the configurable redirection type for each item, with support for 301 (Moved Permanently), 307 (Temporary Redirect) and also 200 (Internal Redirect) (available for Enterprise version only). With the Internal Redirect is now possible to create a "real" URL alias with Joomla.
Last but not least, there are many other features available, such custom error pages, error tracing, referer tracing and so on, that can dramatically improve your SEO ranking. We will describe each one in detail in the next part of this guide. In the following paragraphs we will also learn how to make better use of regular expressions, macros and placeholders to take full advantage from ReDJ.
ReDJ package includes a component for managing list of redirection rules, and a plugin that examines all the requests and redirect them to a different page when needed by an active rule. These are the main steps to start using ReDJ (for the impatient):
Detailed instructions on each step are described in the following paragraphs. In this section we just want to focus on some basic concepts related to ReDJ and how it works.
The first important thing to understand is the "rule" concept. With ReDJ Manager (the component interface) you can create as many items as you want, and each item is a redirection rule. But not necessarily an item corresponds to a single page (i.e. matches just a single URL).
A rule has a "From URL" field that can be full URI or just a part of it. For example, it can be "/home.html", then this rule matches both the URL http://www.mysite.com/home.html and http://www.mysite.com/orders/home.html?view=status. So, it means that with a single rule is possible to match multiple source URLs. But the content of the "From URL" field can be a regular expression, and this provide a powerful way to specify complex search patterns for matching URL. The "Skip" field is similar to From URL", it can be a part of URL and contains a regular expression, but it offers a way to skip the rule. When the skip condition matches the rule is discarded. In the next paragraphs will be shown many regular expression examples.
For any request on the site, the ReDJ plugin compares the requested URL with all the rules enabled in the ordering set for rules. The first matching rule found (if there's at least one) is used for redirect.