Jeremy Newman : set open graph image based on news type

Jeremy Newman jnewman at wine.codeweavers.com
Fri Oct 31 14:36:53 CDT 2014


Module: website
Branch: master
Commit: 5557aa9fcc6518811564acbb9f1921cf3f3ecb7a
URL:    http://source.winehq.org/git/website.git/?a=commit;h=5557aa9fcc6518811564acbb9f1921cf3f3ecb7a

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Fri Oct 31 14:36:33 2014 -0500

set open graph image based on news type

---

 include/plugins/news.php   | 9 +++++++++
 templates/en/news.template | 3 +--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/plugins/news.php b/include/plugins/news.php
index bc9deb7..b8c4da8 100644
--- a/include/plugins/news.php
+++ b/include/plugins/news.php
@@ -26,6 +26,15 @@ switch (true)
 
         // set open graph tags
         $html->meta_og['title'] = trim($vars['title']);
+        $ogmode = preg_replace('/^(.*)({\$root}\/)(wwn|announce)(\/)(.*)$/ms', '$3', $vars['body']);
+        switch ($ogmode)
+        {
+            case 'wwn':
+                $html->meta_og['image'] = "http://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-world-wine-news.png";
+                break;
+            default:
+                $html->meta_og['image'] = "http://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png";
+        }
 
         // add page title
         $html->page_title .= " - {$html->meta_og['title']}";
diff --git a/templates/en/news.template b/templates/en/news.template
index 8ea824f..0443453 100644
--- a/templates/en/news.template
+++ b/templates/en/news.template
@@ -1,12 +1,11 @@
 <!--TITLE:[News]-->
 <!--BLURB:[All the latest news from the Wine community.]-->
-<!--META_OG:[image|http://media.codeweavers.com/pub/crossover/marketing/og/wine-hq-announcement.png]-->
 
 <h1 class="title">News</h1>
 
 <!--EXEC:[news]-->
 
-<hr />
+<hr>
 
 <div class="link-container">
     <p><a href="{$root}/wwn/">World Wine News Archive</a></p>




More information about the wine-cvs mailing list