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

Commit fea9384

Browse files
authored
Merge pull request #823 from symfony-cmf/seo-doc-update
cleanup seo documentation
2 parents 2ad48c2 + 83d893e commit fea9384

File tree

14 files changed

+478
-150
lines changed

14 files changed

+478
-150
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The name of the form group to use in the admin extension.
2+
3+
The caption for the group is determined by translating the group name. If you
4+
change the group, be sure to also define a translation for it.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The name of the form tab to use in the admin extension.
2+
3+
The caption for the tab is determined by translating the tab name. If you
4+
change the tab name, be sure to also define a translation for it.

bundles/block/types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ information.
2828
Sonata Admin
2929
~~~~~~~~~~~~
3030

31-
All block types provided by the Symfony2 CMF BlockBundle come with a admin
31+
All block types provided by the Symfony2 CMF BlockBundle come with an admin
3232
classes for SonataDoctrinePHPCRAdminBundle_. To activate the admin services,
3333
it is enough to load the SonataDoctrinePHPCRAdminBundle in your application
3434
kernel and configure the sonata dashboard as desired.

bundles/seo/alternate_locale.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ find links like the following in the ``<head>`` part of your HTML pages:
1717
<link rel="alternate" href="/de/der-titel" hreflang="de">
1818

1919
When using PHPCR-ODM, there is almost no work to do, as the bundle can use the
20-
Doctrine meta data to figure out which translations exists for a content. More
20+
Doctrine meta data to figure out which translations exist for a content. More
2121
information on translating content with the PHPCR-ODM is in the chapter
2222
:doc:`Doctrine PHPCR-ODM Multilanguage Support <../phpcr_odm/multilang>`.
2323

bundles/seo/configuration.rst

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Configuration Reference
22
=======================
33

4-
The SeoBundle can be configured under the ``cmf_seo`` key in your application
5-
configuration. When using XML, you can use the
4+
The SeoBundle is configured under the ``cmf_seo`` key in your application
5+
configuration. When using XML, use the
66
``http://cmf.symfony.com/schema/dic/seo`` namespace.
77

88
Configuration
@@ -90,7 +90,7 @@ about the usage.
9090
``original_route_pattern``
9191
~~~~~~~~~~~~~~~~~~~~~~~~~~
9292

93-
**type**: ``string`` **default**: ``canonical``
93+
**type**: ``string`` **default**: ``canonical`` **allowed values**: ``canonical`` | ``redirect``
9494

9595
The original route strategy to use when multiple routes have the same content.
9696
Can be one of ``canonical`` or ``redirect``.
@@ -129,6 +129,9 @@ manually or disable the content listener.
129129
.. versionadded:: 1.2
130130
Support for sitemaps was introduced in version 1.2 of the SeoBundle.
131131

132+
For details on the meaning of the sitemap configuration, see the
133+
:doc:`sitemap section <sitemap>`.
134+
132135
.. configuration-block::
133136

134137
.. code-block:: yaml
@@ -142,6 +145,12 @@ manually or disable the content listener.
142145
templates:
143146
html: :sitemap/index.html.twig
144147
xml: ::sitemap:index.xml.twig
148+
loaders:
149+
- _all
150+
guessers:
151+
- _all
152+
voters:
153+
- _all
145154
configurations:
146155
sitemap: ~
147156
@@ -156,6 +165,9 @@ manually or disable the content listener.
156165
<defaults>
157166
<template format="html">CmfSeoBundle:Sitemap:index.html.twig</template>
158167
<template format="xml">CmfSeoBundle:Sitemap:index.xml.twig</template>
168+
<loader>_all</loader>
169+
<guesser>_all</guesser>
170+
<voter>_all</voter>
159171
</defaults>
160172
<configuration name="sitemap"/>
161173
</sitemap>
@@ -173,6 +185,9 @@ manually or disable the content listener.
173185
'html' => 'CmfSeoBundle:Sitemap:index.html.twig',
174186
'xml' => 'CmfSeoBundle:Sitemap:index.xml.twig',
175187
],
188+
'loaders' => ['_all'],
189+
'guessers' => ['_all'],
190+
'voters' => ['_all'],
176191
],
177192
'configurations' => [
178193
'sitemap' => null,
@@ -218,30 +233,22 @@ By default, you have:
218233
* html: CmfSeoBundle:Sitemap:index.html.twig
219234
* xml: CmfSeoBundle:Sitemap:index.xml.twig
220235

221-
``sonata_admin_extension``
222-
~~~~~~~~~~~~~~~~~~~~~~~~~~
223-
224-
If set to ``true``, the Sonata Admin Extension provided by the SeoBundle is
225-
activated.
226-
227-
``enabled``
228-
"""""""""""
236+
``loaders``
237+
***********
229238

230-
**type**: ``enum`` **valid values** ``true|false|auto`` **default**: ``auto``
239+
**type**: ``array`` **default**: [_all]
231240

232-
If ``true``, the Sonata Admin Extension will be activated. If set to ``auto``,
233-
it is activated only if the SonataPhpcrAdminBundle is present.
241+
Limit which of the loaders should be used for this sitemap.
234242

235-
If the :doc:`CoreBundle <../core/introduction>` is registered, this will default to the value
236-
of ``cmf_core.persistence.phpcr.use_sonata_admin``.
243+
``guessers``
244+
************
237245

238-
``form_group``
239-
""""""""""""""
246+
**type**: ``array`` **default**: [_all]
240247

241-
**type**: ``string`` **default**: ``form.group_seo``
248+
``voters``
249+
**********
242250

243-
The name of the form group of the group provided by the Sonata Admin
244-
Extension.
251+
**type**: ``array`` **default**: [_all]
245252

246253
``form``
247254
~~~~~~~~

bundles/seo/error_pages.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ Displaying Relevant Pages in Error Pages
44
.. versionadded:: 1.2
55
The ``SuggestionProviderController`` was introduced in SeoBundle 1.2.
66

7-
You don't want to loose visitors when they hit a 404 error page. A good way to
8-
do this is by showing relevant links on the site, so they can quickly navigate
9-
to another page (or maybe even the page they were looking for in the
10-
beginning).
7+
You don't want to lose visitors when no content is found. Instead of showing a
8+
generic 404 error page, the SEO bundle provides the means to show potentially
9+
relevant links to help the user find something useful.
1110

12-
The CmfSeoBundle provides an error controller that does exactly this. By using
13-
suggestion providers, the controller finds the most relevant pages and shows
14-
this on the error page.
11+
This is implemented in the error controller. That controller uses suggestion
12+
providers to find the most relevant pages and shows them on the error page.
1513

1614
Using the Exception Controller
1715
------------------------------
@@ -60,10 +58,10 @@ comes with two built-in providers:
6058

6159
``ParentSuggestionProvider``
6260
This provides the parent page of the not found page (e.g. ``/blog`` when
63-
``/blog/foo`` resulted in a 404 page).
61+
``/blog/foo`` was not found).
6462
``SiblingSuggestionProvider``
6563
This provides the siblings of the current page (e.g. ``/blog/something``
66-
when ``/blog/foo`` resulted in a 404 page).
64+
when ``/blog/foo`` was not found).
6765

6866
.. note::
6967

bundles/seo/extractors.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Available Extractors
2020
| - | ``getTitle()`` | If the document has a ``getTitle()`` method, |
2121
| | | it'll be used as the page title |
2222
+--------------------------------+---------------------------+----------------------------------------------+
23-
| ``OriginalUrlReadInterface`` | ``getSeoOriginalUrl()`` | Returns a absolute url object to redirect to |
23+
| ``OriginalUrlReadInterface`` | ``getSeoOriginalUrl()`` | Returns an absolute url to redirect to or |
2424
| | | or create a canonical link from |
2525
+--------------------------------+---------------------------+----------------------------------------------+
26-
| ``OriginalRouteReadInterface`` | ``getSeoOriginalRoute()`` | Return a ``Route`` object to redirect to |
26+
| ``OriginalRouteReadInterface`` | ``getSeoOriginalRoute()`` | Returns a ``Route`` object to redirect to |
2727
| | | or create a canonical link from |
2828
+--------------------------------+---------------------------+----------------------------------------------+
2929
| ``ExtrasReadInterface`` | ``getSeoExtras()`` | Returns an associative array using |

bundles/seo/introduction.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ key in ``cmf_seo.content_key``.
135135

136136
If you need different behavior, build your own mechanism to extract the SEO
137137
information and disable this listener at ``cmf_seo.content_listener.enabled``
138-
to avoid duplicated work. Things that happen on every request are expensive in
139-
terms of application performance.
138+
to avoid unnecessary code execution. Things that happen on every request are
139+
critical for your application performance.
140140

141141
The Twig Extension
142142
~~~~~~~~~~~~~~~~~~
@@ -351,9 +351,9 @@ And then configure the translation messages:
351351
.. tip::
352352

353353
You don't have to escape the percent characters here, since the
354-
Translation loaders know how to deal with them.
354+
Translation loaders do not try to evaluate container variables.
355355

356-
For changing the default translation domain (messages), you should use the
356+
For changing the default translation domain, use the
357357
``cmf_seo.translation_domain`` setting:
358358

359359
.. configuration-block::

bundles/seo/seo_aware.rst

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Saving the SeoMetadata in the Object
22
====================================
33

4-
The ``SeoMetadata`` can be saved in the object, so you can persist it into the
5-
database. This option gives admins the possibility of changing the SEO data for
6-
the document.
4+
The ``SeoMetadata`` can be set on your model classes, so that you can persist
5+
it into the database. This option gives admins the possibility to change the SEO
6+
data for the object.
77

8-
In order to save the ``SeoMetadata`` in the object, the object should
8+
In order to save the ``SeoMetadata`` in the model, the object should
99
implement the ``SeoAwareInterface``. This requires a getter and a setter for
1010
the ``SeoMetadata``::
1111

@@ -32,8 +32,8 @@ the ``SeoMetadata``::
3232

3333
.. tip::
3434

35-
If you are using PHP5.4+ you may also benefit from using the trait ``SeoAwareTrait``
36-
to plug these behavior into your model.
35+
Instead of implementing these methods yourself, you can also use the trait
36+
``SeoAwareTrait`` to enable this behavior in your model.
3737

3838
Now you can set some SEO data for this ``Page`` using the metadata::
3939

@@ -91,7 +91,7 @@ To be able to use this document, you have to enable the PHPCR persistence:
9191
bundle. See :doc:`the CoreBundle docs <../core/persistence>` for more
9292
information.
9393

94-
After you've enabled PHPCR, map ``$seoMetadata`` as a child:
94+
After you have enabled PHPCR, map ``$seoMetadata`` as a child:
9595

9696
.. configuration-block::
9797

@@ -178,7 +178,7 @@ And after that, you can use the
178178
Doctrine ORM
179179
------------
180180

181-
You can also use the Doctrine ORM with the CmfSeoBundle. You can just use the
181+
You can also use the Doctrine ORM with the CmfSeoBundle. Use the
182182
``Symfony\Cmf\Bundle\SeoBundle\SeoMetadata`` class and map it as an
183183
object:
184184

@@ -240,9 +240,9 @@ the ``SeoMetadata`` entity.
240240
Form Type
241241
---------
242242

243-
The bundle also provides a special form type called ``Symfony\Cmf\Bundle\SeoBundle\Form\Type\SeoMetadataType``
244-
(use ``seo_metadata`` for Symfony versions older than 2.8). This form type can be
245-
used in forms to edit the ``SeoMetadata`` object::
243+
The bundle also provides a special form type called
244+
``Symfony\Cmf\Bundle\SeoBundle\Form\Type\SeoMetadataType``. This form type can
245+
be used in forms to edit the ``SeoMetadata`` object::
246246

247247
use Sonata\AdminBundle\Form\FormMapper;
248248
use Symfony\Cmf\Bundle\SeoBundle\Form\Type\SeoMetadataType;
@@ -264,17 +264,9 @@ used in forms to edit the ``SeoMetadata`` object::
264264
option is set by default, otherwise you need to explicitly specify it in
265265
your ORM forms.
266266

267-
Sonata Admin Integration
268-
------------------------
269-
270-
Besides providing a form type, the bundle also provides a Sonata Admin
271-
Extension. This extension adds a field for the ``SeoMetadata`` when an admin
272-
edits an object that implements the ``SeoAwareInterface`` in the Sonata Admin
273-
panel.
274-
275-
.. caution::
267+
.. tip::
276268

277-
The Sonata Admin uses the Form Type provided by the CmfSeoBundle, make
278-
sure you have the `BurgovKeyValueFormBundle`_ installed.
269+
The :doc:`SonataPhpcrAdminIntegrationBundle <../sonata_phpcr_admin_integration/seo>`
270+
provides an admin extension for the ``SeoAwareInterface``.
279271

280272
.. _`BurgovKeyValueFormBundle`: https://github.com/Burgov/KeyValueFormBundle

bundles/seo/twig.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ Setting Seo Metadata from Twig
55
The twig extension was added in SeoBundle 1.2.
66

77
This bundle provides a twig function ``cmf_seo_update_metadata``
8-
which lets you populate the seo page from an object.
9-
For details on how populating the SEO page works, read :doc:`introduction`.
8+
which lets you populate the SEO data from an object.
9+
For details on how populating the SEO data works, read :doc:`introduction`.
1010

11-
You must call this function in your twig template before the calls to
12-
``sonata_seo_title`` and ``sonata_seo_metadatas`` functions. The
11+
If you use this function, you must make sure to call this in your twig template
12+
before the calls to ``sonata_seo_title`` and ``sonata_seo_metadatas`` The
1313
recommended set up for this is to create a metadata block in your
1414
base twig template and override it in a sub template, calling
1515
``cmf_seo_update_metadata`` before calling ``parent()``.

bundles/sonata_phpcr_admin_integration/core.rst

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,14 @@ admins as needed - see below for details.
8282

8383
**type**: ``string`` **default**: as in above example.
8484

85-
Defines which form group the fields from this extension will appear in within
86-
the Sonata Admin edit interface.
87-
88-
The caption for the group is determined by translating the group name. If you
89-
change the group, be sure to also define a translation for it.
85+
.. include:: ../_partials/sonata_admin_form_group.rst.inc
9086

9187
``form_tab``
9288
~~~~~~~~~~~~
9389

9490
**type**: ``string`` **default**: as in above example.
9591

96-
Defines which form tab the fields from this extension will appear in within
97-
the Sonata Admin edit interface.
98-
99-
The caption for the tab is determined by translating the tab name. If you
100-
change the tab name, be sure to also define a translation for it.
92+
.. include:: ../_partials/sonata_admin_form_tab.rst.inc
10193

10294
Using Child Models: The Child Sonata Admin Extension
10395
----------------------------------------------------
@@ -108,7 +100,7 @@ for example when adding documents in an overlay with the
108100
``doctrine_phpcr_odm_tree_manager`` or when adding a document in the tree of
109101
the dashboard.
110102

111-
To enable the extension in your admin classes, simply define the extension
103+
To activate the extension in your admin classes, define the extension
112104
configuration in the ``sonata_admin`` section of your project configuration:
113105

114106
.. configuration-block::
@@ -132,8 +124,8 @@ configuration in the ``sonata_admin`` section of your project configuration:
132124
<config xmlns="http://sonata-project.org/schema/dic/admin">
133125
<!-- ... -->
134126
<extension id="cmf_sonata_phpcr_admin_integration.core.extension.child">
135-
<implement>Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface</implement>
136-
<implement>Doctrine\ODM\PHPCR\HierarchyInterface</implement>
127+
<implements>Symfony\Cmf\Bundle\CoreBundle\Model\ChildInterface</implements>
128+
<implements>Doctrine\ODM\PHPCR\HierarchyInterface</implements>
137129
</extension>
138130
</config>
139131
@@ -163,7 +155,7 @@ Editing publication information: Publish Workflow Sonata Admin Extension
163155
When using the :doc:`write interface of the publish workflow <../core/publish_workflow>`,
164156
this admin extension can be used to edit publication information.
165157

166-
To enable the extensions in your admin classes, define the extension
158+
To activate the extensions in your admin classes, define the extension
167159
configuration in the ``sonata_admin`` section of your project configuration:
168160

169161
.. configuration-block::
@@ -189,15 +181,15 @@ configuration in the ``sonata_admin`` section of your project configuration:
189181
<config xmlns="http://sonata-project.org/schema/dic/admin">
190182
<!-- ... -->
191183
<extension id="cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.publishable">
192-
<implement>
184+
<implements>
193185
Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishableInterface
194-
</implement>
186+
</implements>
195187
</extension>
196188
197189
<extension id="cmf_sonata_phpcr_admin_integration.core.extension.publish_workflow.time_period">
198-
<implement>
190+
<implements>
199191
Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishTimePeriodInterface
200-
</implement>
192+
</implements>
201193
</extension>
202194
</config>
203195
</container>

0 commit comments

Comments
 (0)