xen:link canonical not returning full URL - advise please

skicomau

Active member
Using the following in template ad_below_content returns only the base url for all pages.

Code:
<div class="OUTBRAIN" data-widget-id="TF_6" data-src="{xen:link 'canonical:threads', $thread}" data-ob-template="Ski.com.au" ></div>

result

Code:
<div class="OUTBRAIN" data-widget-id="TF_6" data-src="http://forums.ski.com.au/xf/threads/" data-ob-template="Ski.com.au" ></div>

I'm thinking that thread data is not being passed

any advise appreciated.

thanks
 
I'm thinking that thread data is not being passed
Yeah this is most likely it.

If you edit the thread_view template and add anywhere:

Code:
<xen:container var="$thread" value="{$thread}" />

That should make the $thread bar available there.
 
Using the following in template ad_below_content returns only the base url for all pages.

Don't forget that ad_below_content is a page-container level template and isn't specific to threads.

If you're viewing anything other than a thread (eg forum list or forum view), there won't be any thread data.

Of course, if you're only trying to show it on thread pages with a template conditional, that's fine.
 
Yeah this is most likely it.

If you edit the thread_view template and add anywhere:

Code:
<xen:container var="$thread" value="{$thread}" />

That should make the $thread bar available there.

ooohhh

thank you, it felt so promising, but unfortunately did not work.

What I can't figure is this;

thread_view already has 'xen:link canonical:threads' in it twice, once for the canonical link, and once to set as a var for the open_graph_meta template


Code:
<xen:container var="$head.canonical">
    <link rel="canonical" href="{xen:link 'canonical:threads', $thread, 'page={$page}'}" /></xen:container>
<xen:container var="$head.description">
    <meta name="description" content="{xen:helper snippet, $firstPost.message, 155}" /></xen:container>
<xen:container var="$head.openGraph"><xen:include template="open_graph_meta">
        <xen:set var="$url">{xen:link 'canonical:threads', $thread}</xen:set>

They both parse fine, so it must be something to do with where in the tree ad_below_content finds itself.
 
Don't forget that ad_below_content is a page-container level template and isn't specific to threads.

If you're viewing anything other than a thread (eg forum list or forum view), there won't be any thread data.

Of course, if you're only trying to show it on thread pages with a template conditional, that's fine.

yep, thank you, figured that and was fine with it. Not important for list view etc (though ideally if I was actually skilled I would make it conditional from the get go).
 
I forgot that xen:container doesn't quite work the same as xen:set which allows non-string values to be passed in.

Try this instead:

Create a new template, named "ad_below_content_thread" with the code from your first post.

Edit thread_view and add this anywhere:
Code:
<xen:container var="$adBelowContentThread">
    <xen:include template="ad_below_content_thread" />
</xen:container>

Edit ad_below_content and add this:
Code:
{xen:raw $adBelowContentThread}

That should work.
 
Actually, the include template line probably confuses this a bit, it's not really necessary.

You wouldn't actually need the new template.

You could just do:

Code:
<xen:container var="$adBelowContentThread">
    <div class="OUTBRAIN" data-widget-id="TF_6" data-src="{xen:link 'canonical:threads', $thread}" data-ob-template="Ski.com.au" ></div>
</xen:container>

Then this bit remaints the same:
Edit ad_below_content and add this:
Code:
{xen:raw $adBelowContentThread}
 
Back
Top Bottom