Forum Discussion

raula_'s avatar
raula_
Expert
14 years ago

Freemarker variable to get an article url and title of a teaser in a blog page/blog archives page

Hi,

I am trying to create a custom component with an Add this Sharing row.

 

The problem is that in the blog main page, where I have serveral teasers and press "share" you are sharing, in fact, the page but not the article.

 

Looking at the add this API I figure out how to improve this but I do not find the appropiate variable to personalize the url and title I want to share in each teaser,

 

The code I am using is:

 

<#if page.name = "BlogPage" || page.name = "BlogArchivesPage">
	<!-- AddThis Button BEGIN -->
		<div class=
			"addthis_toolbox addthis_default_style addthis_16x16_style"
			addthis:url="${??????}"
		        addthis:title="${????}"
		>
				<a class="addthis_button_facebook"></a>
				<a class="addthis_button_twitter"></a>
				<a class="addthis_button_tuenti"></a>
				<a class="addthis_button_favorites"></a>
				<a class="addthis_button_email"></a>
				<a class="addthis_button_compact"><img src="/html/assets/widget_add_this_small_16x16.png"></a>
		</div>
		<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4e730f112826bd52">
		</script>
	<!-- AddThis Button END -->
</#if>

Where "${??????}" is what I need to fin out.

 

 I have tested variables like: ${http.request.url}, ${coreNode.title} but they still give me the blog url/title, not the article's.

 

Also tried ${page.context.thread.topicMessage.url}, ${page.context.thread.topicMessage.subject}, but throws give a freemarker exception.

 

Appreciate your help :)

1 Reply

  • ChiaraS's avatar
    ChiaraS
    Lithium Alumni (Retired)
    12 years ago

    Hi,

     

    in case somebody else has the same problem, the following variables can be used inside the BlogMessage quilt:

     

    Blog title: ${env.context.message.subject}

    Blog url: ${env.context.message.webUi.url}