diff --git a/bricks.xml b/bricks.xml index d4c895fe69c34f05e6e442357198695aa6eabcef..981d00c3756d8d4980773c281b8b475cf9ac05c3 100644 --- a/bricks.xml +++ b/bricks.xml @@ -97,6 +97,13 @@ </description> </setting> + <setting name="useFaqStructuredData" type="checkbox"> + <locale group="quiqqer/faq" var="brick.accordion.settings.useFaqStructuredData"/> + <description> + <locale group="quiqqer/faq" var="brick.accordion.settings.useFaqStructuredData.desc"/> + </description> + </setting> + </settings> </brick> </bricks> diff --git a/locale.xml b/locale.xml index 5b4a79def5c2f08877bd94a7aa6d015f7573c4b2..711ce007a25d0cd97f1e67187e59cd4d0383d946 100644 --- a/locale.xml +++ b/locale.xml @@ -158,5 +158,15 @@ <de><![CDATA[Seite mit weiteren Informationen. Wenn ausgewählt, wird der Button "Weitere Einträge" unter der FAQ List <strong>immer</strong> angezeigt.]]></de> <en><![CDATA[Page with further information. If selected, the "More entries" button will <strong>always</strong> be displayed below the FAQ List.]]></en> </locale> + <locale name="brick.accordion.settings.useFaqStructuredData"> + <de><![CDATA[FAQ Schema Markup aktivieren]]></de> + <en><![CDATA[Use FAQ schema markup]]></en> + </locale> + <locale name="brick.accordion.settings.useFaqStructuredData.desc" html="true"> + <de><![CDATA[Wenn die Option aktiviert ist, wird ein JSON-LD Code Snippet generiert. Dadurch kann Google die FAQ Einträgen direkt in der Suchergebnissen einblenden. Mehr zu diesem Thema auf + <a href="https://developers.google.com/search/docs/advanced/structured-data/faqpage" target="_blank">Häufig gestellte Fragen mit strukturierten Daten auszeichnen</a>.]]></de> + <en><![CDATA[If enabled a JSON-LD code snippet will be generated. This allows Google to display the FAQ entries directly in the search results. More on this topic at + <a href="https://developers.google.com/search/docs/advanced/structured-data/faqpage" target="_blank">Mark up your FAQs with structured data</a>.]]></en> + </locale> </groups> </locales> diff --git a/src/QUI/FAQ/Controls/Accordion.php b/src/QUI/FAQ/Controls/Accordion.php index ab5d4f35e93f2eac029f4ae87b07dbb28c7e7a68..fa00c221d7880c82cb702d8e45276df1af17c3e1 100644 --- a/src/QUI/FAQ/Controls/Accordion.php +++ b/src/QUI/FAQ/Controls/Accordion.php @@ -26,16 +26,17 @@ class Accordion extends QUI\Control { // default options $this->setAttributes([ - 'class' => 'quiqqer-faqAccordion', - 'order' => 'order_field', - 'stayOpen' => true, // if true make accordion items stay open when another item is opened - 'openFirst' => true, // the first entry is initially opened - 'listMaxWidth' => 0, // positive numbers only, 0 disabled this option. - 'max' => 10, // max entries - 'parentSite' => null, - 'siteType' => 'quiqqer/faq:types/entry', - 'showMoreButton' => false, - 'moreSite' => '' + 'class' => 'quiqqer-faqAccordion', + 'order' => 'order_field', + 'stayOpen' => true, // if true make accordion items stay open when another item is opened + 'openFirst' => true, // the first entry is initially opened + 'listMaxWidth' => 0, // positive numbers only, 0 disabled this option. + 'max' => 10, // max entries + 'parentSite' => null, + 'siteType' => 'quiqqer/faq:types/entry', + 'showMoreButton' => false, + 'moreSite' => '', + 'useFaqStructuredData' => false ]); parent::__construct($attributes); @@ -88,7 +89,7 @@ class Accordion extends QUI\Control if ($showMoreButton || $this->getAttribute('moreSite')) { if ($this->getAttribute('moreSite')) { try { - $MoreSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('moreSite')); + $MoreSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('moreSite')); $showMoreButton = true; } catch (QUI\Exception $Exception) { QUI\System\Log::addInfo($Exception->getMessage()); @@ -134,10 +135,11 @@ class Accordion extends QUI\Control } $Accordion = new QUI\Bricks\Controls\Accordion([ - 'stayOpen' => \boolval($this->getAttribute('stayOpen')), - 'openFirst' => $this->getAttribute('openFirst'), - 'listMaxWidth' => $this->getAttribute('listMaxWidth'), - 'entries' => $entries + 'stayOpen' => \boolval($this->getAttribute('stayOpen')), + 'openFirst' => $this->getAttribute('openFirst'), + 'listMaxWidth' => $this->getAttribute('listMaxWidth'), + 'entries' => $entries, + 'useFaqStructuredData' => $this->getAttribute('useFaqStructuredData'), ]); $this->addCSSFiles($Accordion->getCSSFiles());