Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IEQEFCR
halo
提交
2929d08b
H
halo
项目概览
IEQEFCR
/
halo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
halo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2929d08b
编写于
5月 07, 2019
作者:
RYAN0UP
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed render atom.xml error.
上级
1c3a40cb
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
11 deletion
+22
-11
src/main/java/run/halo/app/controller/content/ContentFeedController.java
...un/halo/app/controller/content/ContentFeedController.java
+8
-3
src/main/java/run/halo/app/controller/content/ContentTagController.java
...run/halo/app/controller/content/ContentTagController.java
+12
-6
src/main/resources/templates/common/web/atom.ftl
src/main/resources/templates/common/web/atom.ftl
+2
-2
未找到文件。
src/main/java/run/halo/app/controller/content/ContentFeedController.java
浏览文件 @
2929d08b
...
...
@@ -2,6 +2,7 @@ package run.halo.app.controller.content;
import
freemarker.template.Template
;
import
freemarker.template.TemplateException
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
;
import
run.halo.app.model.entity.Post
;
import
run.halo.app.model.enums.PostStatus
;
import
run.halo.app.model.vo.PostListVO
;
import
run.halo.app.service.OptionService
;
import
run.halo.app.service.PostService
;
...
...
@@ -140,11 +142,14 @@ public class ContentFeedController {
* @param pageable pageable
* @return List<Post>
*/
private
List
<
Post
>
buildPosts
(
Pageable
pageable
)
{
private
List
<
Post
ListVO
>
buildPosts
(
Pageable
pageable
)
{
if
(
pageable
==
null
)
{
return
postService
.
listAllBy
(
PostStatus
.
PUBLISHED
);
Page
<
Post
>
postPage
=
postService
.
pageBy
(
PostStatus
.
PUBLISHED
,
null
);
return
postService
.
convertToListVo
(
postPage
).
getContent
();
}
return
postService
.
pageBy
(
PostStatus
.
PUBLISHED
,
pageable
).
map
(
postService:
:
filterIfEncrypt
).
getContent
();
Page
<
Post
>
postPage
=
postService
.
pageBy
(
PostStatus
.
PUBLISHED
,
pageable
);
Page
<
PostListVO
>
posts
=
postService
.
convertToListVo
(
postPage
);
return
posts
.
getContent
();
}
}
src/main/java/run/halo/app/controller/content/ContentTagController.java
浏览文件 @
2929d08b
...
...
@@ -13,10 +13,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
run.halo.app.model.entity.Post
;
import
run.halo.app.model.entity.Tag
;
import
run.halo.app.service.OptionService
;
import
run.halo.app.service.PostTagService
;
import
run.halo.app.service.TagService
;
import
run.halo.app.service.ThemeService
;
import
run.halo.app.model.vo.PostListVO
;
import
run.halo.app.service.*
;
import
static
org
.
springframework
.
data
.
domain
.
Sort
.
Direction
.
DESC
;
...
...
@@ -32,14 +30,21 @@ public class ContentTagController {
private
final
TagService
tagService
;
private
final
PostService
postService
;
private
final
PostTagService
postTagService
;
private
final
OptionService
optionService
;
private
final
ThemeService
themeService
;
public
ContentTagController
(
TagService
tagService
,
PostTagService
postTagService
,
OptionService
optionService
,
ThemeService
themeService
)
{
public
ContentTagController
(
TagService
tagService
,
PostService
postService
,
PostTagService
postTagService
,
OptionService
optionService
,
ThemeService
themeService
)
{
this
.
tagService
=
tagService
;
this
.
postService
=
postService
;
this
.
postTagService
=
postTagService
;
this
.
optionService
=
optionService
;
this
.
themeService
=
themeService
;
...
...
@@ -84,7 +89,8 @@ public class ContentTagController {
Tag
tag
=
tagService
.
getBySlugNameOfNonNull
(
slugName
);
final
Pageable
pageable
=
PageRequest
.
of
(
page
-
1
,
optionService
.
getPostPageSize
(),
sort
);
Page
<
Post
>
posts
=
postTagService
.
pagePostsBy
(
tag
.
getId
(),
pageable
);
Page
<
Post
>
postPage
=
postTagService
.
pagePostsBy
(
tag
.
getId
(),
pageable
);
Page
<
PostListVO
>
posts
=
postService
.
convertToListVo
(
postPage
);
final
int
[]
rainbow
=
PageUtil
.
rainbow
(
page
,
posts
.
getTotalPages
(),
3
);
model
.
addAttribute
(
"is_tags"
,
true
);
...
...
src/main/resources/templates/common/web/atom.ftl
浏览文件 @
2929d08b
...
...
@@ -22,7 +22,7 @@
<title>
${post.title!}
</title>
<link>
${options.blog_url!}/archives/${post.url!}
</link>
<comments>
${options.blog_url!}/archives/${post.url!}#comments
</comments>
<pubDate>
${post.createTime}
</pubDate>
<pubDate>
${post.createTime
!
}
</pubDate>
<dc:creator>
<![CDATA[${user.nickName!}]]>
</dc:creator>
<
#if post.categories??
&&
post.categories?size gt 0>
...
...
@@ -40,7 +40,7 @@
${post.formatContent!}
]]>
</content:encoded>
<slash:comments>
${post.comment
s?size
}
</slash:comments>
<slash:comments>
${post.comment
Count!0
}
</slash:comments>
</item>
<
/#list>
<
/#if>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录