============================================
How to do Search Engine Optimisation in Odoo
============================================
How is SEO handled in Odoo?
===========================
Search Engine Optimization (SEO) is a set of good practices to optimize
your website so that you get a better ranking in search engines like
Google. In short, a good SEO allows you to get more visitors.
Some examples of SEO rules: your web pages should load faster, your page
should have one and only one title ``
``, your website should have a
``/sitemap.xml`` file, etc.
To guarantee Odoo Website and Odoo
eCommerce users have a great SEO, Odoo abstracts all the technical
complexities of SEO and handles everything for you, in the best possible
way.
Page Speed
==========
Introduction
------------
The time to load a page is an important criteria for search engines. A faster
website not only improves your visitor's experience, but gives
you a better page ranking. Some studies have shown that, if you divide the time to
load your pages by two (e.g. 2 seconds instead of 4 seconds), the
visitor abandonment rate is also divided by two. (25% to 12.5%). One
extra second to load a page could `cost $1.6b to Amazon in
sales `__.
.. image:: media/seo01.png
:align: center
Fortunately, Odoo does all the magic for you. Below, you will find the
tricks Odoo uses to speed up your page loading time. You can compare how
your website ranks using these two tools:
- `Google Page Speed `__
- `Pingdom Website Speed Test `__
Static Resources: CSS
---------------------
All CSS files are pre-processed, concatenated, minified, compressed and
cached (server-side and browser-side). The result:
- only one CSS file request is needed to load a page
- this CSS file is shared and cached amongst pages, so that when the
visitor clicks on another page, the browser doesn't have to even
load a single CSS resource.
- this CSS file is optimized to be small
**Pre-processed:** The CSS framework used by Odoo is Bootstrap.
Although a theme might use another framework, most of `Odoo
themes `__ extend and customize
Bootstrap directly. Since Odoo supports Less and Sass, you can modify
CSS rules instead of overwriting them through extra CSS lines,
resulting in a smaller file.
**Concatenated:** every module or library you might use in Odoo has its
own set of CSS, Less or Sass files (eCommerce, blogs, themes, etc.). Having
several CSS files is great for the modularity, but not good for the
performance because most browsers can only perform 6 requests in
parallel resulting in lots of files loaded in series. The
latency time to transfer a file is usually much longer than the actual
data transfer time, for small files like .JS and .CSS. Thus, the time to
load CSS resources depends more on the number of requests to be done
than the actual file size.
To address this issue, all CSS / Less / Sass files are concatenated into
a single .CSS file to send to the browser. So a visitor has **only one
.CSS file to load** per page, which is particularly efficient. As the
CSS is shared amongst all pages, when the visitor clicks on another
page, the browser does not even have to load a new CSS file!
================================= =============================================
**Both files in the ** **What the visitor gets (only one file)**
================================= =============================================
/\* From bootstrap.css \*/ .text-muted {
.text-muted { color: #666;
color: #777; background: yellow
background: yellow; }
}
/\* From my-theme.css \*/
.text-muted {
color: #666;
}
================================= =============================================
The CSS sent by Odoo includes all CSS / Less / Sass of all pages /
modules. By doing this, additional page views from the same visitor will
not have to load CSS files at all. But some modules might include huge
CSS/Javascript resources that you do not want to prefetch at the first
page because they are too big. In this case, Odoo splits this resource
into a second bundle that is loaded only when the page using it is
requested. An example of this is the backend that is only loaded when
the visitor logs in and accesses the backend (/web).
.. note::
If the CSS file is very big, Odoo will split it into two smaller
files to avoid the 4095 selectors limit per sheet of Internet Explorer.
But most themes fit below this limit.
**Minified:** After being pre-processed and concatenated, the resulting
CSS is minified to reduce its size.
============================ ==============================
**Before minification** **After minification**
============================ ==============================
/\* some comments \*/ .text-muted {color: #666}
.text-muted {
color: #666;
}
============================ ==============================
The final result is then compressed, before being delivered to the
browser.
Then, a cached version is stored server-side (so we do not have
to pre-process, concatenate, minify at every request) and browser-side
(so the same visitor will load the CSS only once for all pages they
visit).
Static Resources: Javascript
----------------------------
As with CSS resources, Javascript resources are also concatenated,
minified, compressed and cached (server-side and browser-side).
Odoo creates three Javascript bundles:
- One for all pages of the website (including code for parallax
effects, form validation, etc.)
- One for common Javascript code shared among frontend and backend
(Bootstrap)
- One for backend specific Javascript code (Odoo Web Client interface
for your employees using Odoo)
Most visitors of your website will only need the first two bundles,
resulting in a maximum of two Javascript files to load to render one
page. As these files are shared across all pages, further clicks by the
same visitor will not load any other Javascript resource.
.. note::
If you work in debug mode, the CSS and Javascript are neither
concatenated, nor minified. Thus, it's much slower. But it allows you to
easily debug with the Chrome debugger as CSS and Javascript resources
are not transformed from their original versions.
Images
------
When you upload new images, Odoo automatically
compresses them to reduce their sizes (lossless compression for .PNG
and .GIF and lossy compression for .JPG).
From the upload button, you have the option to keep the original image
unmodified if you prefer to optimize the quality of the image rather
than performance.
.. image:: media/seo02.png
:align: center
.. note::
Odoo compresses images when they are uploaded to your website, not
when requested by the visitor. Thus, it's possible that, if you use a
third-party theme, it will provide images that are not compressed
efficiently. But all images used in Odoo official themes have been
compressed by default.
When you click on an image, Odoo shows you the Alt and title attributes
of the ```` tag. You can click on it to set your own title and Alt
attributes for the image.
.. image:: media/seo03.png
:align: center
When you click on this link, the following window will appear:
.. image:: media/seo04.png
:align: center
Odoo's pictograms are implemented using a font (`Font
Awesome `__ in most
Odoo themes). Thus, you can use as many pictograms as you want in your
page, they will not result in extra requests to load the page.
.. image:: media/seo05.png
:align: center
CDN
---
If you activate the CDN feature in Odoo, static resources (Javascript,
CSS, images) are loaded from a Content Delivery Network. Using a Content
Delivery Network has three advantages:
- Load resources from a nearby server (most CDN have servers in main
countries around the globe)
- Cache resources efficiently (no computation resources usage on your
own server)
- Split the resource loading on different services allowing to load
more resources in parallel (since the Chrome limit of 6 parallel
requests is by domain)
You can configure your CDN options from the **Website Admin** app, using
the Configuration menu. Here is an example of configuration you can use:
.. image:: media/seo06.png
:align: center
HTML Pages
----------
The HTML pages can be compressed, but this is usually handled by your web
server (NGINX or Apache).
The Odoo Website builder has been optimized to guarantee clean and short
HTML code. Building blocks have been developed to produce clean HTML
code, usually using Bootstrap and the HTML editor.
As an example, if you use the color picker to change the color of a
paragraph to the primary color of your website, Odoo will produce the
following code:
``
My Text
``
Whereas most HTML editors (such as CKEditor) will produce the following
code:
``