Actions

Portal

Difference between revisions of "Search Engine Optimisation"

From Joomla! Documentation

m (Fixing Broken Site When SEF is Enabled)
(Added link to $live_site variable article. Spelling corrections. Substituted <pre> tags for some <nowiki> tags.)
Line 1: Line 1:
SEO refers to Search Engine Optimisation. SEO is the process of improving the volume and quality of traffic to a web site from search engines. SEO can also be referred to as SEF, or Search Engine Friendly.
+
SEO refers to Search Engine Optimisation. SEO is the process of improving the volume and quality of traffic to a Website from search engines. SEO can also be referred to as SEF, or Search Engine Friendly.
  
 
See also:
 
See also:
Line 6: Line 6:
  
 
[[Category:Landing Pages]]
 
[[Category:Landing Pages]]
 
 
 
 
'''Joomla specific SEO / SEF tricks:'''
 
'''Joomla specific SEO / SEF tricks:'''
 
 
 
 
== Fixing Broken Site When SEF is Enabled ==
 
== Fixing Broken Site When SEF is Enabled ==
 +
Situation: Joomla template missing. Pages displayed with no templates.
  
Joomla Template missing, pages displayed with no templates.
+
To correct the problem when enabling Search Engine Friendly URLs in the Global Configuration, edit the configuration.php file variable $live_site.
  
To correct a problem when enabling Search Engine Friendly URLs in the Global Configuration of Joomla 1.5.2 and tested and verified to be true for 1.5.3 as well.
+
The default $live_site variable in configuration.php is
 +
<pre>var $live_site = ''</pre>
  
" ... edit configuration.php as var $live_site = <nowiki>'http://www.mysite.com'</nowiki> "
+
If Joomla is not in the root, then you need to include the folder path  
 
+
<pre>var $live_site = 'http://www.mysite.com/myjoomlafolder'</pre>
Note that default configuration.php is <nowiki>var $live_site = ''</nowiki>
+
 
+
 
+
Posted by ''dextercowley''
+
 
+
NOTE:  ONLY do this if you're having a problem.  SEF works perfectly fine without it on 95% of servers.  $live_site was only added for those other 5%.
+
 
+
UPDATE: As of J! 1.5.14 the above hint doesn't work as there is no such variable in configuration.php
+
 
+
Update: in J 1.5.15 this fix works. If Joomla is not in the root then need to include folder path  
+
$live_site = <nowiki>'http://www.mysite.com/myjoomlafolder'</nowiki> "
+
  
 +
See also [[Why does your site get messed up when you turn on SEF (Search Engine Friendly URLs)?]]
 
== Add a static text in the <nowiki><title></nowiki> ==
 
== Add a static text in the <nowiki><title></nowiki> ==
 
 
Open the file:
 
Open the file:
 
libraries/joomla/document/html/renderer/head.php
 
libraries/joomla/document/html/renderer/head.php
  
 
Search for the next piece of code:
 
Search for the next piece of code:
 +
<pre>
 +
$strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;
 +
</pre>
  
<nowiki>$strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;</nowiki>
+
Add your static text for example:
 +
<pre>
 +
$strHtml .= $tab.'<title> All about Canada - '.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;
 +
</pre>
  
Add your statict text for example:
+
The text in the <title> tag is very important to search engines.
  
<nowiki>$strHtml .= $tab.'<title> All about Canada - '.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;</nowiki>
+
If you need great search results for the phrase "All about Canada," put the static text before of the $document->getTitle();
 
+
The text into the <title> tag is very important for the search engines.
+
 
+
If you need obtain a great search results for the word "All about Canada" I recommend your put the static text before of the $document->getTitle();
+
 
+
Other important thing, is don't use symbols like <nowiki>":", "-", "$",</nowiki> etc for the title.
+
 
+
 
+
Posted by ''juanparati''
+
 
+
 
+
 
+
== Add heading tags in the titles for more relevance ==
+
  
 +
Don't use symbols like <nowiki>":", "-", "$",</nowiki> in the title.
  
 +
== Add Heading Tags in the Titles for More Relevance ==
 
Search engines give a special relevance to the sentences between a "H" tag like <nowiki><h1></nowiki>, <nowiki><h2></nowiki> or <nowiki><h3></nowiki>.
 
Search engines give a special relevance to the sentences between a "H" tag like <nowiki><h1></nowiki>, <nowiki><h2></nowiki> or <nowiki><h3></nowiki>.
  
Line 67: Line 47:
  
 
search for this piece of code (Line 5):
 
search for this piece of code (Line 5):
 
+
<pre>
<nowiki>
+
 
<div class="componentheading<?php echo $this->params->get('pageclass_sfx');?>">
 
<div class="componentheading<?php echo $this->params->get('pageclass_sfx');?>">
 
   <?php echo $this->escape($this->params->get('page_title')); ?>
 
   <?php echo $this->escape($this->params->get('page_title')); ?>
 
</div>
 
</div>
</nowiki>
+
</pre>
 
+
  
 
add your "H" tags between the title like this:
 
add your "H" tags between the title like this:
 
+
<pre>     
 
+
<nowiki>     
+
 
<div class="componentheading<?php echo $this->params->get('pageclass_sfx');?>">
 
<div class="componentheading<?php echo $this->params->get('pageclass_sfx');?>">
 
   <h1><?php echo $this->escape($this->params->get('page_title')); ?></h1>
 
   <h1><?php echo $this->escape($this->params->get('page_title')); ?></h1>
 
</div>
 
</div>
</nowiki>
+
</pre>
 
+
  
 
If you add more "H" tags between the joomla titles search into the tmpl directories for the code:
 
If you add more "H" tags between the joomla titles search into the tmpl directories for the code:
  
<nowiki>   get('page_title')</nowiki>
+
<pre>
 
+
get('page_title')
 +
</pre>
  
 
And add the "H" tags.
 
And add the "H" tags.
  
Remember normalize the font-size of the "H" tags using css, for example
+
Remember to normalize the font-size of the "H" tags using CSS. For example, edit your template css and add something like:
 +
<pre>
 +
.componentheading h1 {
 +
font-size: 16px;
 +
}
 +
</pre>
  
Edit your template css and add something like:
+
To override the output of a component or module see: [[How to override the output from the Joomla! core]]
 
+
 
+
<nowiki>    .componentheading h1 {
+
      font-size: 16px;
+
    }</nowiki>
+
 
+
 
+
For override the output from a component or module see: [[How to override the output from the Joomla! core]]
+
 
+
 
+
Posted by ''juanparati''
+
  
 
== Utilize RSS Feeds for Search Engines ==
 
== Utilize RSS Feeds for Search Engines ==
 
 
 
Some search engines allow you to submit feeds to them for utilization in their search capabilities. Yahoo! Site Explorer [siteexplorer.search.yahoo.com] is one such service. This is a powerful way for sites that regularly update their content to get relevant search placement. It can also be used for simpler sites that have fairly static pages. This procedure will explain how to create feeds for pages within your site, be it static or not.
 
Some search engines allow you to submit feeds to them for utilization in their search capabilities. Yahoo! Site Explorer [siteexplorer.search.yahoo.com] is one such service. This is a powerful way for sites that regularly update their content to get relevant search placement. It can also be used for simpler sites that have fairly static pages. This procedure will explain how to create feeds for pages within your site, be it static or not.
  
Line 118: Line 86:
 
Under the advanced parameters for the menu item, make sure that the show a feed link item is set to show.
 
Under the advanced parameters for the menu item, make sure that the show a feed link item is set to show.
 
Make sure the syndicate module is published. If it isn't go to the Extensions Menu, select Module Manager, select the new icon, select Syndicate and publish the module in the desired position. You can then view the site and copy the URLs for each feed to submit to each search engine.  
 
Make sure the syndicate module is published. If it isn't go to the Extensions Menu, select Module Manager, select the new icon, select Syndicate and publish the module in the desired position. You can then view the site and copy the URLs for each feed to submit to each search engine.  
 
  
 
'''NOTE: You should have SEF enabled for this to work well.'''
 
'''NOTE: You should have SEF enabled for this to work well.'''
 
 
Posted by ''betweenbrain''
 
 
 
 
== Dynamic MetaDesc in a list of articles by category ==
 
== Dynamic MetaDesc in a list of articles by category ==
 
 
 
When you view a list of articles by category, joomla put into the page the default configuration metadescription, but perhaps we want write the category description into the metatag for SEO reasons.
 
When you view a list of articles by category, joomla put into the page the default configuration metadescription, but perhaps we want write the category description into the metatag for SEO reasons.
  
For this we need open the file:
+
For this we need open the file includes/application.php.
includes/application.php
+
  
 
Search for this piece of code in the function &getParams:
 
Search for this piece of code in the function &getParams:
 
+
<pre>
<nowiki>
+
$params->def( 'page_title'      , $title );
    $params->def( 'page_title'      , $title );
+
$params->def( 'page_description', $description );
    $params->def( 'page_description', $description );
+
</pre>
</nowiki>
+
 
+
 
+
 
Add this code before:
 
Add this code before:
 
+
<pre>     
<nowiki>     
+
 
if (strcasecmp($_GET['view'],'category')==0) {         
 
if (strcasecmp($_GET['view'],'category')==0) {         
            $description = $database->GetOne("SELECT description FROM #__categories WHERE id={$_GET['id']}");       
+
  $description = $database->GetOne("SELECT description FROM #__categories WHERE id={$_GET['id']}");       
    }
+
}
</nowiki>
+
</pre>
 
+
 
+
It's ok, now the metadescription is more dynamic when you view a list of articles by category.
+
 
+
  
Posted by ''juanparati''
+
Now the metadescription is more dynamic when you view a list of articles by category.
  
 
== Change default article SEF suffix from .html to .htm ==
 
== Change default article SEF suffix from .html to .htm ==
 
 
If you need to change default article SEF suffix from .html to .htm (for example, if you need to move static site to Joomla and keep existing urls with .htm extensions), you need apply following patch to includes/router.php (working on Joomla 1.5.9, should work on other 1.5.x versions):
 
If you need to change default article SEF suffix from .html to .htm (for example, if you need to move static site to Joomla and keep existing urls with .htm extensions), you need apply following patch to includes/router.php (working on Joomla 1.5.9, should work on other 1.5.x versions):
 
  
 
  Index: includes/router.php
 
  Index: includes/router.php
Line 194: Line 143:
  
 
'''Note''': This patch only for bundled SEF plugin
 
'''Note''': This patch only for bundled SEF plugin
 
--[[User:Nettroll|Nettroll]] 21:18, 28 October 2009 (UTC)
 

Revision as of 18:00, 23 November 2010

SEO refers to Search Engine Optimisation. SEO is the process of improving the volume and quality of traffic to a Website from search engines. SEO can also be referred to as SEF, or Search Engine Friendly.

See also:

Joomla specific SEO / SEF tricks:

Contents

Fixing Broken Site When SEF is Enabled

Situation: Joomla template missing. Pages displayed with no templates.

To correct the problem when enabling Search Engine Friendly URLs in the Global Configuration, edit the configuration.php file variable $live_site.

The default $live_site variable in configuration.php is

var $live_site = ''

If Joomla is not in the root, then you need to include the folder path

var $live_site = 'http://www.mysite.com/myjoomlafolder'

See also Why does your site get messed up when you turn on SEF (Search Engine Friendly URLs)?

Add a static text in the <title>

Open the file: libraries/joomla/document/html/renderer/head.php

Search for the next piece of code:

$strHtml .= $tab.'<title>'.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;

Add your static text for example:

$strHtml .= $tab.'<title> All about Canada - '.htmlspecialchars($document->getTitle()).'</title>'.$lnEnd;

The text in the <title> tag is very important to search engines.

If you need great search results for the phrase "All about Canada," put the static text before of the $document->getTitle();

Don't use symbols like ":", "-", "$", in the title.

Add Heading Tags in the Titles for More Relevance

Search engines give a special relevance to the sentences between a "H" tag like <h1>, <h2> or <h3>.

I you want put a "H" tag to joomla 1.5 you need edit some files:

Override components/com_content/views/category/tmpl/blog.php

search for this piece of code (Line 5):

<div class="componentheading<?php echo $this->params->get('pageclass_sfx');?>">
  <?php echo $this->escape($this->params->get('page_title')); ?>
</div>

add your "H" tags between the title like this:

    
<div class="componentheading<?php echo $this->params->get('pageclass_sfx');?>">
   <h1><?php echo $this->escape($this->params->get('page_title')); ?></h1>
</div>

If you add more "H" tags between the joomla titles search into the tmpl directories for the code:

get('page_title')

And add the "H" tags.

Remember to normalize the font-size of the "H" tags using CSS. For example, edit your template css and add something like:

.componentheading h1 {
font-size: 16px;
}

To override the output of a component or module see: How to override the output from the Joomla! core

Utilize RSS Feeds for Search Engines

Some search engines allow you to submit feeds to them for utilization in their search capabilities. Yahoo! Site Explorer [siteexplorer.search.yahoo.com] is one such service. This is a powerful way for sites that regularly update their content to get relevant search placement. It can also be used for simpler sites that have fairly static pages. This procedure will explain how to create feeds for pages within your site, be it static or not.

In Joomla! 1.5.3: If you are not using sections and categories for your static pages, create a generic section for these static pages, such as "website content". Create separate categories for each static page. Change your menu items from, for instance, Article Layout to Category Blog Layout. Under the advanced parameters for the menu item, make sure that the show a feed link item is set to show. Make sure the syndicate module is published. If it isn't go to the Extensions Menu, select Module Manager, select the new icon, select Syndicate and publish the module in the desired position. You can then view the site and copy the URLs for each feed to submit to each search engine.

NOTE: You should have SEF enabled for this to work well.

Dynamic MetaDesc in a list of articles by category

When you view a list of articles by category, joomla put into the page the default configuration metadescription, but perhaps we want write the category description into the metatag for SEO reasons.

For this we need open the file includes/application.php.

Search for this piece of code in the function &getParams:

$params->def( 'page_title'      , $title );
$params->def( 'page_description', $description );

Add this code before:

    
if (strcasecmp($_GET['view'],'category')==0) {         
   $description = $database->GetOne("SELECT description FROM #__categories WHERE id={$_GET['id']}");       
}

Now the metadescription is more dynamic when you view a list of articles by category.

Change default article SEF suffix from .html to .htm

If you need to change default article SEF suffix from .html to .htm (for example, if you need to move static site to Joomla and keep existing urls with .htm extensions), you need apply following patch to includes/router.php (working on Joomla 1.5.9, should work on other 1.5.x versions):

Index: includes/router.php
===================================================================
--- includes/router.php (revision 13023)
+++ includes/router.php (working copy)
@@ -57,8 +57,13 @@
                        {
                                if($suffix = pathinfo($path, PATHINFO_EXTENSION))
                                {
-                                       $path = str_replace('.'.$suffix, , $path);
-                                       $vars['format'] = $suffix;
+                                       if ($suffix == 'htm') {
+                                               $path = str_replace('.'.$suffix, , $path);
+                                               $vars['format'] = 'html';
+                                       } else {
+                                               $path = str_replace('.'.$suffix, , $path);
+                                               $vars['format'] = $suffix;
+                                       }
                                }
                        }
                }
@@ -93,7 +98,8 @@
                        {
                                if($format = $uri->getVar('format', 'html'))
                                {
-                                       $route .= '.'.$format;
+                                       //$route .= '.'.$format;
+                                       $route .= '.htm';
                                        $uri->delVar('format');
                                }
                        }


Note: This patch only for bundled SEF plugin