惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
V
Visual Studio Blog
宝玉的分享
宝玉的分享
IT之家
IT之家
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
I
InfoQ
B
Blog RSS Feed
T
Threatpost
博客园_首页
M
MIT News - Artificial intelligence
Spread Privacy
Spread Privacy
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Know Your Adversary
Know Your Adversary
U
Unit 42
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
月光博客
月光博客
Scott Helme
Scott Helme
T
Tor Project blog
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Last Week in AI
Last Week in AI
S
Schneier on Security
Vercel News
Vercel News
博客园 - Franky
C
Cybersecurity and Infrastructure Security Agency CISA
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
L
LangChain Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
The GitHub Blog
The GitHub Blog
雷峰网
雷峰网
Latest news
Latest news
C
CXSECURITY Database RSS Feed - CXSecurity.com
Hugging Face - Blog
Hugging Face - Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
S
Security Affairs
A
About on SuperTechFans
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
大猫的无限游戏
大猫的无限游戏
W
WeLiveSecurity
Cisco Talos Blog
Cisco Talos Blog
罗磊的独立博客

博客园 - Baldwin

Orchard运用 - 网站样例 Orchard运用 - 为评论启用Gravatar头像 Orchard运用 - 特定主题添加独立代码文件 Orchard运用 - 整合多说评论插件 Orchard运用 - 设置网站Favicon标识 Orchard运用 - 理解App_Data目录结构 Orchard运用 - 为博客启用Markdown编辑器 Orchard运用 - 如何隐藏去除某些Meta标记 Orchard运用 - 学习资源分享 Orchard运用 - 整合Disqus评论插件 Orchard运用 - 在页面每篇随笔添加编辑链接 Orchard运用 - 定制呈现最新博客文章 Orchard运用 - 导入旧随笔导致归档的问题 Orchard运用 - 如何删除部分内容显示 你需要么,dnn多语言解决方案? 如何定制dnn的FckEditor Blog已迁移到dnnsun.com(最新DotNetNuke咨询平台) 再论call和apply MarqueeNews2.2发布
Orchard运用 - 定制博客分页显示
Baldwin · 2014-05-05 · via 博客园 - Baldwin

一般,对于条目过多的系统或博客,分页显示是最简单的方式。目前分页方式基本有三种格式:

1.显示所有信息,包括标明当前页面,提供上一页和下一页链接和使用首页和末页链接。

2.只标注上一页和下一页链接。

3.无限滚动自动分页。

Orchard默认是提供第一种方式,也就是会在内容底部呈现一个分页导航,类似博客园首页就是这样。

而博客系统Wordpress中,第二种方式更为流行和通用。如果你的博客是从Wordpress迁移到Orchard的, 那么自然你需要做些定制修改。今天就简单分享一个解决方案。

1. 在当前主题Theme目录新建三个文件:

Pager.cshtml

Pager.First.cshtml

Pager.Last.cshtml

@{
// number of page number links to show, 0 means no link, 1 means only the current page, or more accepted.

Model.Quantity = 0;

Model.PreviousText = T("Newer");
Model.NextText = T("Older");
Model.Classes.Add("group");
Model.Metadata.Alternates.Clear();
Model.Metadata.Type = "Pager_Links";
}
@Display(Model)

其他两个文件内容为空即可。

3. 保存之,如果可能的话你有必要重新定制分页的样式:

/* Pager
***************************************************************/
.pager { list-style: none; margin-top: 1em; margin-bottom: -1em; }
.pager li { display: inline-block; background-color: #787878; border-right: 1px solid #ffffff; font-size: 0.8824em; line-height: 1.5333em; margin-right: 0.3333em; }
.pager a { padding: 0px 1em 2px 1em; display: block; color: #ffffff; text-decoration: none; text-transform: none; font-variant: small-caps;
-webkit-transition: background-color 0.27s ease;
-moz-transition: background-color 0.27s ease;
-o-transition: background-color 0.27s ease;
transition: background-color 0.27s ease;
}
.pager a:hover { text-decoration: none; background-color: #e20f14; color: #ffffff; }

这只是一个样例, 你可以任意调整。

题外话:目前只是知道如何修改,其中原理还说不明道不清,基本就是通过覆盖核心的模版来说实现的。

相关资源链接

Overriding the Pager rendering in Orchard