0

Any advice on how / or where I can include the 'share this' script so I can include social sharing buttons at the bottom of my Orchard CMS blog posts. Ideally I would not use the gallery or any installer, simply just the classic implementation -- which I have done before, but I am not sure in which file I can add my script in Orchard's MVC architecture.

4

2 回答 2

1

使用Shape Tracing来识别构建博客文章的不同模板。其中一些模板在整个应用程序中共享,因此还要了解Alternates

查看~/Common/Views/Parts.Common.Metadata.cshtml 要覆盖此视图,您应该将其复制到您的主题Views文件夹,并根据需要进行修改。如果您希望仅为博客文章修改此模板,请Parts.Common.Metadata-BlogPost.cshtml在主题视图文件夹中命名您的新文件。这是一个替代方案,并BlogPost告诉 Orchard 仅将此模板用于博客帖子的内容类型。

于 2016-04-21T05:39:16.240 回答
0

我一直在我自己的博客上使用一个非常简单的 HTML 小部件来执行此操作,因为共享本质上是客户端的事情,而且它是迄今为止最简单的选择。这是我在该小部件中使用的 HTML:

<p>
  <a href="https://twitter.com/intent/tweet" class="share"><img src="/media/foo/Icons/squaretwitter.svg" style="width: 20px; height: 20px;" alt="Tweet this" title="Tweet this" /></a>
  <a href="https://facebook.com/sharer.php" class="share share-facebook"><img src="/media/foo/Icons/squarefacebook.svg" style="width: 20px; height: 20px;" alt="Share this on Facebook" title="Share this on Facebook" /></a>
  <a href="https://plus.google.com/share" class="share"><img src="/media/foo/Icons/squaregoogleplus.svg" style="width: 20px; height: 20px;" alt="Share this on Google+" title="Share this on Google+" /></a>
  <a href="https://ssl.reddit.com/submit" class="share"><img src="/media/foo/Icons/squarereddit.svg" style="width: 20px; height: 20px;" alt="Share this on Reddit" title="Share this on Reddit" /></a>
</p>

请注意,我没有使用共享脚本,而是使用静态链接,因为我希望尽可能保持页面精简和快速加载,并且我认为这些脚本是一个重大负担,几乎没有什么好处。但是,如果您更喜欢将脚本放入 HTML 小部件中,则可以,它完全可以工作。

画廊中还有一些现成的模块可用于此类事情,这将使您只需将一部分添加到博客内容类型并完成它。

于 2016-04-25T18:54:21.273 回答