My web pages start with something like this:

[% PROCESS header.inc
Title = "Shelterbelt Production"
Desc = "Walk through on the economics of producing large numbers of medium
size trees for use in shelterbelt plantings."
FBimage="$base/Images/AdPix/Trade_Show/2013-06-27_20-32-32.jpg"

%]

Note the FBimage variable.

In Header.inc

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">

[% USE String %]
[% USE MultiMarkdown %]

[% pathchunks = template.name.split('/') ;
chunks = pathchunks.max
pathchunks.$chunks = pathchunks.last.replace('.tt2','.html');
CurWebPage = '/' _ template.name.replace('.tt2','.html');

    CurWebLink = base _ CurWebPage
%]


<head>
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" />
$ExtraMetaContent
  <title>$Title</title>
  <base href="$base" />
  <meta name="description" content="$Desc" />

  <meta property="og:site_name" content="Tree Farm for Sale"/>
    <meta property="og:type" content="article"/>
  <meta property="og:image" content="$FBimage"/>
  <meta property="og:title" content="$Title"/>
  <meta property="og:url" content="$CurWebLink "/>
  <link rel="shortcut icon" href="/favicon.ico"
type="image/vnd.microsoft.icon" />
  <link type="text/css" href="/2col.css" rel="stylesheet" />
  <link rel="canonical" href=$CurWebLink />
  <meta name="viewport" content="width=device-width, initial-scale=1" />


Ok.

The problem occurs with the open graph FBimage tag.  If I don't define it
in my header later then facebook uses no image at all when shared.
Otherwise it will default to the first image on the page.

How do I modify Header.inc so that it doesn't put in the line

 <meta property="og:image" content="$FBimage"/>

if FBimage isn't defined in the calling template?



Regards

Sherwood
_______________________________________________
templates mailing list
templates@lists.ourshack.com
https://lists.ourshack.com/mailman/listinfo/templates

Reply via email to