diff --git a/bricks.xml b/bricks.xml index 981d00c3756d8d4980773c281b8b475cf9ac05c3..d11e7040fe812600dd3e6f2865cf454faa0960db 100644 --- a/bricks.xml +++ b/bricks.xml @@ -98,9 +98,9 @@ </setting> <setting name="useFaqStructuredData" type="checkbox"> - <locale group="quiqqer/faq" var="brick.accordion.settings.useFaqStructuredData"/> + <locale group="quiqqer/faq" var="faq.settings.useFaqStructuredData"/> <description> - <locale group="quiqqer/faq" var="brick.accordion.settings.useFaqStructuredData.desc"/> + <locale group="quiqqer/faq" var="faq.settings.useFaqStructuredData.desc"/> </description> </setting> diff --git a/locale.xml b/locale.xml index 711ce007a25d0cd97f1e67187e59cd4d0383d946..e1b49ce0bd462e44986817bbaa47ab96063ca07d 100644 --- a/locale.xml +++ b/locale.xml @@ -43,6 +43,18 @@ <de><![CDATA[FAQ-Eintrag]]></de> <en><![CDATA[FAQ Entry]]></en> </locale> + + <locale name="faq.settings.useFaqStructuredData"> + <de><![CDATA[FAQ Schema Markup aktivieren]]></de> + <en><![CDATA[Use FAQ schema markup]]></en> + </locale> + <locale name="faq.settings.useFaqStructuredData.desc"> + <de><![CDATA[Wenn die Option aktiviert ist, wird ein JSON-LD Code Snippet generiert. Dadurch kann Google die FAQ Einträgen direkt in den 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> + <locale name="quiqqer/faq:types/category.title"> <de><![CDATA[FAQ-Kategorie ]]></de> <en><![CDATA[FAQ Category]]></en> @@ -158,15 +170,5 @@ <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/site.xml b/site.xml index 2ac83479c657ff4e254b1e0f55599a18e01e7190..c3dfe17e325c77e5eedf3239b68a47176fcf91f7 100644 --- a/site.xml +++ b/site.xml @@ -16,6 +16,7 @@ </desc> <attributes> + <attribute default="1">quiqqer.faq.settings.useFaqStructuredData</attribute> <attribute default="default">quiqqer.faq.settings.template</attribute> <attribute default="1">quiqqer.faq.settings.accordion.stayOpen</attribute> <attribute default="0">quiqqer.faq.settings.offset</attribute> @@ -28,6 +29,15 @@ <locale group="quiqqer/faq" var="quiqqer.faq.category.settings.title"/> </title> + <input conf="quiqqer.faq.settings.useFaqStructuredData" type="checkbox"> + <text> + <locale group="quiqqer/faq" var="faq.settings.useFaqStructuredData"/> + </text> + <description> + <locale group="quiqqer/faq" var="faq.settings.useFaqStructuredData.desc"/> + </description> + </input> + <select conf="quiqqer.faq.settings.template"> <text> <locale group="quiqqer/faq" var="quiqqer.faq.category.settings.template"/> diff --git a/types/category.html b/types/category.html index d99c49a1f42254c61c2cc4aef272a392a6630e7e..b5e8d365b2c015bc534605749cd49c6fabce9eec 100644 --- a/types/category.html +++ b/types/category.html @@ -66,6 +66,10 @@ <hr /> {/if} {/foreach} + + {if $faqStructuredData} + {$faqStructuredData} + {/if} </section> {/if} diff --git a/types/category.php b/types/category.php index a7b1ac5837ce1e0553313be10d67294fab99e3e5..519189ab046cf6a0e00cd67a85d97ad809f4d078 100644 --- a/types/category.php +++ b/types/category.php @@ -4,18 +4,21 @@ $entries = $Site->getChildren([ 'type' => 'quiqqer/faq:types/entry' ]); -$faqTemplate = 'default'; -$offset = false; -$FAQControl = null; +$faqTemplate = 'default'; +$offset = false; +$FAQControl = null; +$useFaqStructuredData = $Site->getAttribute('quiqqer.faq.settings.useFaqStructuredData'); +$faqStructuredData = ''; // html string switch ($Site->getAttribute('quiqqer.faq.settings.template')) { case 'accordion': $faqTemplate = 'accordion'; $FAQControl = new \QUI\FAQ\Controls\Accordion([ - 'max' => 50, - 'stayOpen' => $Site->getAttribute('quiqqer.faq.settings.accordion.stayOpen'), - 'parentSite' => $Site + 'max' => 50, + 'stayOpen' => $Site->getAttribute('quiqqer.faq.settings.accordion.stayOpen'), + 'parentSite' => $Site, + 'useFaqStructuredData' => $useFaqStructuredData ]); break; @@ -23,12 +26,17 @@ switch ($Site->getAttribute('quiqqer.faq.settings.template')) { default: $offset = intval($Site->getAttribute('quiqqer.faq.settings.offset')); $faqTemplate = 'default'; + if ($useFaqStructuredData) { + $FAQControl = new QUI\Bricks\Controls\Accordion(); + $faqStructuredData = $FAQControl->createJSONLDFAQSchemaCode(); + } break; } $Engine->assign([ - 'entries' => $entries, - 'faqTemplate' => $faqTemplate, - 'offset' => $offset, - 'FAQControl' => $FAQControl + 'entries' => $entries, + 'faqTemplate' => $faqTemplate, + 'offset' => $offset, + 'FAQControl' => $FAQControl, + 'faqStructuredData' => $faqStructuredData ]);