Updated Pipedrive's templates, mostly.
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
{% comment %} This is generic code that will make ld+json tag from any FAQ on page {% endcomment %}
|
||||
<script>
|
||||
addEventListener('DOMContentLoaded', () => {
|
||||
let ldTag = `
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "FAQPage",
|
||||
"mainEntity": [`;
|
||||
document.querySelectorAll('.faq-element').forEach(faq_element => {
|
||||
let question = faq_element.querySelector('.faq-question-text').querySelector('.lang-en').innerHTML.replaceAll('"', '\"');
|
||||
let answer = faq_element.querySelector('.faq-answer').querySelector('.lang-en').innerHTML.replaceAll('"', '\"');
|
||||
let faq_part = `
|
||||
{
|
||||
"@type": "Question",
|
||||
"name": "${question.replaceAll('"', '\\"')}",
|
||||
"acceptedAnswer": {
|
||||
"@type": "Answer",
|
||||
"text": "${answer.replaceAll('"', '\\"')}"
|
||||
}
|
||||
},`;
|
||||
ldTag = ldTag.concat(faq_part);
|
||||
})
|
||||
ldTag = ldTag.slice(0, -1) + `
|
||||
]
|
||||
}
|
||||
<\/script>`
|
||||
document.head.insertAdjacentHTML('beforeend', ldTag)
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user