我想爲我的博客文章創建一個Facebook分享選項,它可以工作,但它不需要文章文字或圖像,但第一個圖像和文字在(單頁)網站。我如何更改我的共享代碼,以便它可以使用我點擊FB共享按鈕的文章圖像和文本?modX添加og:image和og:描述動態
這是博客文章模板,與FB共享代碼包括:
<div class="contentLeft">
<div class="roundimage">
<a href="[[+roundImage:phpthumbof=`h=750&zc=1`]]" class="colorbox" title="[[+roundImageCaption]]"><img class="round"
src="[[+roundImage:phpthumbof=`w=170&h=170&zc=1&q=95`]]" alt="[[+roundImageCaption]]" /></a>
</div>
<script type="text/javascript">function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}</script><a href="http://www.facebook.com/share.php?u=[(site_url)][~[*id*]~]" onclick="return fbs_click()" target="_blank" class="fbsharebutton"></a>
<h4 class="blue" style="margin-bottom:10px; margin-top:0;">[[+articleHeadline]]</h4>
<p class="datetext">[[+datetimeText]]</p>
<p class="readmoretext">[[+articleText]]</p>
<div class="divider"></div>
</div>
我希望你能幫助!謝謝!
我很抱歉,但我不明白你想告訴我什麼。如何在鏈接中嵌入og:image和og:description信息? –
據我瞭解,您正試圖將每篇文章的圖片和說明嵌入到您的列表中,直接在鏈接中。但是,您的Facebook鏈接只需要網址就可以了。網址鏈接到文章的各個頁面,而不是文章列表頁面。個人頁面可以使用metaog:image和og:description標籤。 –
是的,但我沒有單獨的文章頁面,這是一個問題........有沒有辦法,在FB共享鏈接中交出這些元素,還是我必須找到一種方法讓每篇文章成爲一個單獨的頁面? –