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

Commit 4904733

Browse files
committed
Merge pull request #659 from symfony-cmf/content-listener-enabled
Add docs for content_listener.enable option
2 parents 427a874 + afd767d commit 4904733

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

bundles/seo/configuration.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ The translation domain to use when translating the title and description
7070
template. See :ref:`bundles-seo-title-description-template` for more
7171
information.
7272

73-
7473
``title``
7574
~~~~~~~~~
7675

@@ -95,16 +94,33 @@ about the usage.
9594
The original route strategy to use when multiple routes have the same content.
9695
Can be one of ``canonical`` or ``redirect``.
9796

97+
``content_listener``
98+
~~~~~~~~~~~~~~~~~~~~
99+
100+
.. versionadded:: 1.2
101+
The ``content_listener`` configuration key was introduced in SeoBundle 1.2.
102+
103+
``enabled``
104+
"""""""""""
105+
106+
**type**: ``boolean`` **default**: ``true``
107+
108+
Whether or not the :ref:`bundles-seo-content-listener` should be loaded.
109+
98110
``content_key``
99-
~~~~~~~~~~~~~~~
111+
"""""""""""""""
100112

101113
**type**: ``string`` **default**: ``null`` (or ``DynamicRouter::CONTENT_KEY`` when RoutingBundle is enabled)
102114

103115
The name of the request attribute which contains the content object. This is
104116
used by the ContentListener to extract SEO information automatically. If the
105117
RoutingBundle is present, this defaults to ``DynamicRouter::CONTENT_KEY``
106118
(which evaluates to ``contentDocument``), otherwise you must define this
107-
manually.
119+
manually or disable the content listener.
120+
121+
.. versionadded:: 1.2
122+
In versions of the SeoBundle prior to 1.2, the ``content_key`` was
123+
configured directly in the ``cmf_seo`` root.
108124

109125
``sonata_admin_extension``
110126
~~~~~~~~~~~~~~~~~~~~~~~~~~

bundles/seo/introduction.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,18 @@ The ContentListener
124124
~~~~~~~~~~~~~~~~~~~
125125

126126
The ``Symfony\Cmf\Bundle\SeoBundle\EventListener\ContentListener`` looks for a
127-
content document in the request attributes. If it finds a document, it calls
128-
``SeoPresentationInterface::updateSeoPage``.
127+
content document in the request attributes. If it finds a document that is
128+
suitable for extracting metadata, the listener calls
129+
``SeoPresentationInterface::updateSeoPage`` to populate the metadata
130+
information.
129131

130132
If the :doc:`RoutingBundle <../routing/introduction>` is installed, the default
131133
attribute name is defined by the constant ``DynamicRouter::CONTENT_KEY``. When
132-
not using the RoutingBundle, you need to configure a key in
133-
``cmf_seo.content_key``.
134+
not using the RoutingBundle, you need to disable the listener or configure a
135+
key in ``cmf_seo.content_key``.
136+
137+
You may also want to disable this listener when implementing your own mechanism
138+
to extract SEO information.
134139

135140
Extracting Metadata
136141
~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)