将 'share this' 添加到 Orchard CMS 博客文章的底部

adding 'share this' to the bottom of orchard CMS blog posts

有关如何/或在何处包含 'share this' 脚本的任何建议,以便我可以在我的 Orchard CMS 博客文章的底部包含社交共享按钮。理想情况下,我不会使用图库或任何安装程序,而只是使用经典实现——我以前做过,但我不确定我可以在哪个文件中添加我在 Orchard 的 MVC 架构中的脚本。

使用Shape Tracing, to identify the different templates that build up a Blog Post. Some of those templates are shared throughout the app, so learn also about Alternates.

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

我一直在使用一个非常简单的 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 小部件,则可以,它完全可以工作。

图库中还有一些现成的模块可用于此类操作,您只需将一部分添加到博客内容类型即可完成。