b.org: Implement rich results for blog posts master
authorPablo Vazquez <pablo@blender.org>
Tue, 25 Jan 2022 18:13:04 +0000 (19:13 +0100)
committerPablo Vazquez <pablo@blender.org>
Tue, 25 Jan 2022 18:13:04 +0000 (19:13 +0100)
themes/bthree/single.php

index 9211165d5756c45e5cdd4de955742138a9e62979..c24d7c65c0713da374d82bb3c9cc73cb436db651 100644 (file)
@@ -12,6 +12,24 @@ $hide_author = array('user-stories', 'press'); /* Hide the author for posts in t
 
        <div class="blog-container">
                <?php while ( have_posts() ) : the_post(); ?>
 
        <div class="blog-container">
                <?php while ( have_posts() ) : the_post(); ?>
+                       <script type="application/ld+json">
+                               {
+                                       "@context": "https://schema.org",
+                                       "@type": "NewsArticle",
+                                       "headline": "<?php the_title(); ?>",
+                                       <?php if (has_post_thumbnail()): ?>"image": [
+                                               "<?php the_post_thumbnail_url(); ?>"
+                                       ],<?php endif; ?>
+                                       "datePublished": "<?php the_date('c'); ?>",
+                                       "dateModified": "<?php the_modified_date('c'); ?>",
+                                       "author": [{
+                                                       "@type": "Person",
+                                                       "name": "<?php the_author(); ?>",
+                                                       "url": "<?php echo get_author_posts_url(get_the_author_meta('id')); ?>"
+                                               }]
+                               }
+                       </script>
+
                        <div class="<?=($page_width ? $page_width : 'container')?>">
                                <?php if (is_preview()):?>
                                <div class="row">
                        <div class="<?=($page_width ? $page_width : 'container')?>">
                                <?php if (is_preview()):?>
                                <div class="row">