是否可以在博客循环内的Shopify网站的博客页面上添加Facebook图标?

时间:2012-11-28 20:44:22

标签: facebook icons blogs shopify liquid

我希望用户能够在Shopify网站的博客页面上欣赏单篇文章。我在博客循环中添加了社交媒体图标。

blog.liquid

{% for article in blog.articles %}<!-- START ENTRY {{ forloop.index }} -->
<div id="post{{ article.id }}">

{{ article.content | strip_html | truncate: 40 }} <br/> <a href="{{ article.url}}">Read More</a>

{% assign description = article.title | escape | replace:' ','%20' %}
{% assign link = article.url %}
{% include 'social' %}

</div>
{% endfor %}

social.liquid Snippet

<div class="social-plugins">

<span class="twitter">
<a href="http://twitter.com/share"{% if template == 'product' or template == 'article' or template == 'blog' %} data-url="{{ shop.url }}{{ link }}"{% endif %} data-text="{% if template == 'product' %}{{ product.title | escape }} by {{ product.vendor | escape }}{% elsif template == 'blog' %}{{ social.title | escape }}{% else %}{{ page_title | escape }}{% endif %}" class="twitter-share-button" data-count="horizontal" data-via="bondiNYC">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
</span>

<span class="facebook">
<iframe src="//www.facebook.com/plugins/like.php?href={{shop.url}}{{link}}&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"</iframe>
</span>

<span class="pinterest">
<a href="http://pinterest.com/pin/create/button/?url={{ shop.url }}{{ link }}&description={{ description }}&media={{src | escape}}" class="pin-it-button" count-layout="none">Pin It</a>
</span>

</div>

如果我只是加入{{shop.url}} {{blog.url}},那么按钮就可以了,但是当我添加{{shop.url}} {{link}}时却没有。 {{link}}是根据页面分配的。

1 个答案:

答案 0 :(得分:1)

在我的商店 - 我这样做是通过使用:

{{ shop.url }}{{ article.url }}

这将返回要插入facebook / twitter / pinterest iframe的文章的URL。

注意:请务必检查代码是否在blog.liquid页面上呈现。我在同等的social.liquid

中执行此操作
相关问题