micahsheets / kh-news
此包最新版本(1.3.3)没有可用的许可信息。
SilverStripe 4的新闻模块
1.3.3
2023-07-11 17:36 UTC
Requires
README
要求
SilverStripe 4
概述
从Nyeholt新闻模块分支并升级至SS 4
新闻模块提供了一种简单的方法来创建和发布网站上的新闻文章。在某种程度上,它与博客模块相似,但新闻文章更侧重于新闻稿风格的 内容 - 这意味着新闻文章可以由普通内容、托管文件(例如PDF)或完全独立的网站上的文章表示。此外,新闻文章允许作者指定与主要内容不同的摘要,这对于在您的网站上聚合内容引用非常有用,并允许作者为文章附加缩略图。
新闻容器可以配置为自动将包含的文章按日期层次结构归档,为存档目的生成层次结构。
与博客模块不同,新闻模块完全不支持小部件,并且默认不启用评论。虽然这些功能可以通过自己添加,但它不是模块功能的核心。
安装
此模块不在packagist中,因此需要几个步骤。
通过在composer.json
中添加以下内容,将klundt-hosmer/kh-news
指定为存储库:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/klundt-hosmer/kh-news.git"
}
],
然后使用composer require klundt-hosmer/kh-news:^1.3.2
添加模块
文档
新闻模块还提供了自动将文章按年份、月份和日期顺序归档的功能。这将为新闻文章自动提供“存档”类型的功能。要启用此功能,请选择新闻容器上的“自动归档包含的文章”复选框。
已知问题
当使用自动归档功能创建文章时,如果其最终父位置不可见,则文章最初将出现在站点树根目录中,尽管它已经在正确的位置下创建。刷新树可以解决这个问题。
当容器包含子容器页面时,使用子部分循环时将不会启用分页,因为分页详细信息将针对每个子容器页面分开。使用TotalChildArticles循环而不是子部分来解决这个问题。
<% if TotalChildArticles %>
<div <% if FirstLast %>class="$FirstLast"<% end_if %>>
<% include NewsListItem %>
</div>
<% if TotalChildArticles.MoreThanOnePage %>
<div id="NextPrevLinks" class="news-pagination">
<% if TotalChildArticles.NotLastPage %>
<div id="NextLink" class="next">
<p><a class="next" href="$TotalChildArticles.NextLink"
title="View the next page">See older articles</a></p>
</div>
<% end_if %>
<% if TotalChildArticles.NotFirstPage %>
<div id="PrevLink" class="previous">
<p><a class="prev" href="$TotalChildArticles.PrevLink"
title="View the previous page">See newer articles</a></p>
</div>
<% end_if %>
<span>
<% if TotalChildArticles.PaginationSummary %><% loop TotalChildArticles.PaginationSummary %>
<% if CurrentBool %>
<p class="current">
$PageNum
</p>
<% else %>
<a class="pagination-link" href="$Link" i
title="View page number $PageNum">$PageNum</a>
<% end_if %>
<% end_loop %><% end_if %>
</span>
</div>
<% end_if %>
<% end_if %>