Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 2aceba9

Browse files
committed
Fixed standards
1 parent c3aaa44 commit 2aceba9

File tree

1 file changed

+99
-108
lines changed

1 file changed

+99
-108
lines changed

bundles/seo/introduction.rst

Lines changed: 99 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,59 @@
11
SeoContentBundle
22
================
33

4-
This bundle helps you optimize your websites
5-
for search engines by collecting SEO data in
6-
a central location and making it available in
7-
twig. It is built on top of the SonataSeoBundle.
4+
This bundle helps you optimize your websites for search engines by
5+
collecting SEO data in a central location and making it available in twig.
6+
It is built on top of the SonataSeoBundle.
87

98
Preface
109
-------
1110

12-
Search engines punish you when you provide
13-
the same content under several URLs.
14-
The CMF allows you to have several URLs
15-
for the same content if you need that.
16-
There are two solutions to avoid penalties
17-
with search engines:
11+
Search engines punish you when you provide the same content under several
12+
URLs. The CMF allows you to have several URLs for the same content if you
13+
need that. There are two solutions to avoid penalties with search engines:
1814

19-
- Create a canonical link that identifies the
20-
original URL: ``<link rel="canonical" href="/route/org/content">``
15+
* Create a canonical link that identifies the original URL:
16+
``<link rel="canonical" href="/route/org/content">``;
17+
* Redirect to THE original url.
2118

22-
- Redirect to THE original url.
19+
Both take care on search engines, which does not like it to have same content
20+
under different routes.
2321

24-
Both take care on search engines, which does not like
25-
it to have same content under different routes.
26-
27-
The SeoBundle uses sonatas SeoBundle and its TwigHelper
28-
to render the the `SeoMetadata` into your Pag. So you
29-
should have a look at the documentation
30-
at `sonata seo documentation_`
22+
The SeoBundle uses sonatas SeoBundle and its TwigHelper to render the the
23+
`SeoMetadata` into your Pag. So you should have a look at the documentation at
24+
`sonata seo documentation_`
3125

3226
Installation
3327
------------
3428

35-
You can install the bundle in 2 different ways:
36-
37-
* Use the official Git repository `with github`_
38-
* Install it `with composer`_ (``symfony-Symfony CMF/seo-content-bundle`` on `Packagist`_).
39-
40-
Both bundles need to be registered in the ``appKernel``
29+
You can install this bundle `with composer`_ using the ``symfony-Symfony
30+
CMF/seo-content-bundle`` package on `Packagist`_.
4131

42-
.. code-block:: php
32+
Both the CmfSeoBundle and SonataSeoBundle need to be registered in the
33+
``AppKernel``::
4334

4435
// app/appKernel.php
36+
37+
// ...
4538
public function registerBundles()
4639
{
4740
$bundles = array(
48-
//register both SeoBundles
41+
// ...
4942
new Sonata\SeoBundle\SonataSeoBundle(),
5043
new Symfony\Cmf\Bundle\SeoBundle\CmfSeoBundle(),
5144
);
5245

46+
// ...
47+
5348
return $bundles;
5449
}
5550

56-
A very basic use case
57-
_____________________
51+
A Very Basic Use Case
52+
~~~~~~~~~~~~~~~~~~~~~
5853

59-
The simplest use case would be to just set some configuration
60-
to the sonata_seo configuration section and set the TwigHelper
61-
into your template.
54+
The simplest use case would be to just set some configuration to the
55+
``sonata_seo`` configuration section and use the twig helper in your
56+
templates.
6257

6358
.. configuration-block::
6459

@@ -88,14 +83,17 @@ into your template.
8883
),
8984
));
9085
91-
To get a deeper look into the sonata seo-bundle configuration you
92-
should visit its documentation at `sonata seo documentation_`
93-
The only thing to do now is to insert the TwigHelper into your
94-
template:
86+
.. seealso::
9587

96-
.. code-block:: html
88+
To get a deeper look into the SonataSeoBundle configuration, you should visit
89+
the `Sonata documentation`_.
90+
91+
The only thing to do now is to use the twig helper in your templates:
92+
93+
.. code-block:: html+jinja
9794

9895
<!-- app/Resources/views/base.html.twig -->
96+
<!DOCTYPE html>
9997
<html>
10098
<head>
10199
{{ sonata_seo_title() }}
@@ -107,11 +105,11 @@ template:
107105
</body>
108106
</html>
109107

110-
This will render a Page with the tilte defined above. The
111-
information definded for description and keywords will go
112-
into the meta tags.
108+
This will render a page with the default title ("Page's default title") as
109+
title element. The information definded for description and keywords will go
110+
into the correct metatags.
113111

114-
Using SeoMetadata - Admin extension and a form type
112+
Using SeoMetadata - Admin Extension and a form type
115113
---------------------------------------------------
116114

117115
The basic example would work perfect without the Symfony CMF
@@ -123,35 +121,35 @@ called `SeoMetada`:
123121

124122
.. code-block:: php
125123
126-
/**
124+
/**
127125
* This string contains the information where we will find the
128126
* original content. Depending on the setting for the
129127
* cmf_seo.content.pattern, we will do an redirect to this url or
130128
* create a canonical link with this value as the href attribute.
131129
*
132130
* @var string
133-
*/
131+
*
134132
private $originalUrl;
135133
136134
/**
137135
* If this string is set, it will be inserted as a meta
138136
* tag for the page description.
139137
*
140138
* @var string
141-
*/
139+
*
142140
private $metaDescription;
143141
144142
/**
145143
* This comma separated list will contain the Keywords for
146144
* the page's meta information.
147145
*
148146
* @var string
149-
*/
147+
*
150148
private $metaKeywords;
151149
152-
A object should implement
153-
the `SeoAwareInterface`, which simply forced to implement
154-
setter/getter for the seo metadata. A simple example would be:
150+
A object should implement the ``SeoAwareInterface``, which simply forces to
151+
implement the setter and getter for the seo metadata. A simple example would
152+
be:
155153

156154
.. code-block:: php
157155
@@ -193,14 +191,12 @@ setter/getter for the seo metadata. A simple example would be:
193191
$manager->persist($route);
194192
$manager->flush();
195193
196-
Visiting the site with the url ``/seo-content`` (same template
197-
shown above) will show a Page with "Documents own tile" as
198-
title, "This ist the text for the description meta tag" in
199-
the description, "Seo, Content" in the keywords and a canonical
200-
link with ``href="/original/url/of/content"``. But what about
201-
some default string to just concatenate defaults and documents
202-
own values? Just add some more configs to the cmf_seo configuration
203-
section.
194+
Visiting the site with the url ``/seo-content`` (same template shown above)
195+
will show a Page with "Documents own tile" as title, "This ist the text for
196+
the description meta tag" in the description, "Seo, Content" in the keywords
197+
and a canonical link with ``href="/original/url/of/content"``. But what about
198+
some default string to just concatenate defaults and documents own values?
199+
Just add some more configs to the cmf_seo configuration section.
204200

205201
.. configuration-block::
206202

@@ -246,10 +242,9 @@ section.
246242
),
247243
);
248244
249-
As you will notice, you got the opportunity to set Symfony
250-
translation key for your default values for title and
251-
description. So you will got Multi-Language-Support
252-
out of the box. Just define your values for default
245+
As you will notice, you got the opportunity to set Symfony translation key for
246+
your default values for title and description. So you will got
247+
Multi-Language-Support out of the box. Just define your values for default
253248
title/description as translations:
254249

255250
.. code-block:: xml
@@ -271,18 +266,17 @@ title/description as translations:
271266
</file>
272267
</xliff>
273268
274-
If you want to concatenate your documents values with the
275-
default ones you need them as parameters in you translation
276-
target.
269+
If you want to concatenate your documents values with the default ones you
270+
need them as parameters in you translation target.
277271

278272
.. tip::
279273

280-
If you does not what to open a translation file for two entry,
281-
just set ``Default title | %%content_title%%``or ``Default
282-
description. %%content_description%%``.
274+
If you does not what to open a translation file for two entry, just set
275+
``Default title | %%content_title%%``or ``Default description.
276+
%%content_description%%``.
283277

284-
For changing the default translation domain (messages), the SeoBundle
285-
provides a configuration value:
278+
For changing the default translation domain (messages), the SeoBundle provides
279+
a configuration value:
286280

287281
.. configuration-block::
288282

@@ -311,8 +305,7 @@ provides a configuration value:
311305
),
312306
);
313307
314-
For redirects instead of canonical links (default) set the following
315-
option:
308+
For redirects instead of canonical links (default) set the following option:
316309

317310
.. configuration-block::
318311

@@ -341,11 +334,11 @@ option:
341334
),
342335
);
343336
344-
This value will cause a redirect to the url persisted in the
345-
``originalUrl`` property of the ``SeoMetadata``.
337+
This value will cause a redirect to the url persisted in the ``originalUrl``
338+
property of the ``SeoMetadata``.
346339

347-
The SeoMetadata contains a form type for your Symfony Form.
348-
Just create you form with the following key:
340+
The SeoMetadata contains a form type for your Symfony Form. Just create you
341+
form with the following key:
349342

350343
.. code-block:: php
351344
@@ -355,40 +348,39 @@ Just create you form with the following key:
355348
...
356349
;
357350
358-
For SonataAdminBundle user the SeoBundle provides an admin extension
359-
to add that form to your form configuration.
351+
For SonataAdminBundle user the SeoBundle provides an admin extension to add
352+
that form to your form configuration.
360353

361-
Using extractors for getting your documents seo metadata
354+
Using Extractors for Getting Your Documents Seo Metadata
362355
--------------------------------------------------------
363356

364-
Instead of setting every value to the ``SeoMetadata`` manually
365-
a strategy solution to extract the values from your content document
366-
can be chosen. To do so you got the possibility to add strategies to
367-
your document for each value one by one. Depending on the
368-
strategy a method on the document is called to extract the
369-
value. It is up to the developer how to implement that extraction methods.
370-
371-
+--------------------------+------------------------+-----------------------------------------------+
372-
|StrategyInterface | method call | Description |
373-
+==========================+========================+===============================================+
374-
|SeoDescriptionExtractor | getSeoDescription() | the documents part for the page description |
375-
+--------------------------+------------------------+-----------------------------------------------+
376-
|SeoOriginalRouteExtractor | getSeoOriginalRoute() |return a ``Route`` object to redirect to |
377-
| | |or create a canonical link from |
378-
+--------------------------+------------------------+-----------------------------------------------+
379-
|SeoOriginalUrlExtractor | getSeoOriginalUrl() |return a absolute url object to redirect to |
380-
| | |or create a canonical link from |
381-
+--------------------------+------------------------+-----------------------------------------------+
382-
|SeoTitleExtractor | getSeoTitle() |return a string for setting the page title |
383-
+--------------------------+------------------------+-----------------------------------------------+
384-
|TitleReadExtractor | - |if implemented the ``getTitle()`` the |
385-
| | |extractor will use this |
386-
+--------------------------+------------------------+-----------------------------------------------+
387-
388-
For customizing the extraction process you have got the opportunity
389-
to create your own extractor. Just by implementing the
390-
``SeoExtractorInterface`` and tagging the service as
391-
``cmf_seo.extractor``
357+
Instead of setting every value to the ``SeoMetadata`` manually a strategy
358+
solution to extract the values from your content document can be chosen. To do
359+
so you got the possibility to add strategies to your document for each value
360+
one by one. Depending on the strategy a method on the document is called to
361+
extract the value. It is up to the developer how to implement that extraction
362+
methods.
363+
364+
+-----------------------------------+---------------------------+---------------------------------------------+
365+
| StrategyInterface | method call | Description |
366+
+===================================+===========================+=============================================+
367+
| ``SeoDescriptionReadInterface`` | ``getSeoDescription()`` | the documents part for the page description |
368+
+-----------------------------------+---------------------------+---------------------------------------------+
369+
| ``SeoOriginalRouteReadInterface`` | ``getSeoOriginalRoute()`` | return a ``Route`` object to redirect to |
370+
| | | or create a canonical link from |
371+
+-----------------------------------+---------------------------+---------------------------------------------+
372+
| ``SeoOriginalUrlReadInterface`` | ``getSeoOriginalUrl()`` | return a absolute url object to redirect to |
373+
| | | or create a canonical link from |
374+
+-----------------------------------+---------------------------+---------------------------------------------+
375+
| ``SeoTitleReadInterface`` | ``getSeoTitle()`` | return a string for setting the page title |
376+
+-----------------------------------+---------------------------+---------------------------------------------+
377+
| - | ``getTitle()`` | if implemented the ``getTitle()`` the |
378+
| | | extractor will use this |
379+
+-----------------------------------+---------------------------+---------------------------------------------+
380+
381+
For customizing the extraction process, you have got the opportunity to create
382+
your own extractor. Just by implementing the ``SeoExtractorInterface`` and
383+
tagging the service as ``cmf_seo.extractor``
392384

393385
.. code-block:: xml
394386
@@ -412,5 +404,4 @@ to create your own extractor. Just by implementing the
412404
413405
.. _`with composer`: http://getcomposer.org
414406
.. _`packagist`: https://packagist.org/packages/symfony-cmf/menu-bundle
415-
.. _`with github`: git clone https://github.com/symfony-cmf/SeoContentBundle
416-
.. _`sonata seo documentation`: http://sonata-project.org/bundles/seo/master/doc/index.html
407+
.. _`Sonata documentation`: http://sonata-project.org/bundles/seo/master/doc/index.html

0 commit comments

Comments
 (0)