mirror of https://github.com/halo-dev/halo
✨ 支持文章检索
parent
24846b0089
commit
f7533f4d7d
|
@ -34,30 +34,31 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* 查询所有文章 根据文章类型
|
* 查询所有文章 根据文章类型
|
||||||
*
|
*
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> findPostsByPostType(String postType);
|
List<Post> findPostsByPostType(String postType);
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页查询文章
|
|
||||||
*
|
|
||||||
* @param postType post or page
|
|
||||||
* @param pageable 分页信息
|
|
||||||
*
|
|
||||||
* @return Page
|
|
||||||
*/
|
|
||||||
Page<Post> findPostsByPostType(String postType, Pageable pageable);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询
|
* 模糊查询
|
||||||
*
|
*
|
||||||
* @param keyWord keyword
|
* @param postType0 postType0
|
||||||
|
* @param postStatus0 postStatus0
|
||||||
|
* @param postTitle postTitle
|
||||||
|
* @param postType1 postType1
|
||||||
|
* @param postStatus1 postStatus1
|
||||||
|
* @param postContent postContent
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
* @return Page
|
||||||
* @return List
|
|
||||||
*/
|
*/
|
||||||
List<Post> findByPostTitleLike(String keyWord, Pageable pageable);
|
Page<Post> findByPostTypeAndPostStatusAndPostTitleLikeOrPostTypeAndPostStatusAndPostContentLike(
|
||||||
|
String postType0,
|
||||||
|
Integer postStatus0,
|
||||||
|
String postTitle,
|
||||||
|
String postType1,
|
||||||
|
Integer postStatus1,
|
||||||
|
String postContent,
|
||||||
|
Pageable pageable
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据文章的状态查询 分页
|
* 根据文章的状态查询 分页
|
||||||
|
@ -65,7 +66,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* @param status 0,1,2
|
* @param status 0,1,2
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
* @param pageable 分页信息
|
* @param pageable 分页信息
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostsByPostStatusAndPostType(Integer status, String postType, Pageable pageable);
|
Page<Post> findPostsByPostStatusAndPostType(Integer status, String postType, Pageable pageable);
|
||||||
|
@ -75,7 +75,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
*
|
*
|
||||||
* @param status 0,1,2
|
* @param status 0,1,2
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> findPostsByPostStatusAndPostType(Integer status, String postType);
|
List<Post> findPostsByPostStatusAndPostType(Integer status, String postType);
|
||||||
|
@ -85,7 +84,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
*
|
*
|
||||||
* @param postUrl 路径
|
* @param postUrl 路径
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post findPostByPostUrlAndPostType(String postUrl, String postType);
|
Post findPostByPostUrlAndPostType(String postUrl, String postType);
|
||||||
|
@ -95,7 +93,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
*
|
*
|
||||||
* @param postId 文章编号
|
* @param postId 文章编号
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post findPostByPostIdAndPostType(Long postId, String postType);
|
Post findPostByPostIdAndPostType(Long postId, String postType);
|
||||||
|
@ -104,21 +101,19 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* 查询指定日期之前的文章
|
* 查询指定日期之前的文章
|
||||||
*
|
*
|
||||||
* @param postDate 日期
|
* @param postDate 日期
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM halo_post WHERE post_status = 0 AND post_type='post' AND post_date < :postDate ORDER BY post_date DESC LIMIT 1", nativeQuery = true)
|
@Query(value = "SELECT * FROM halo_post WHERE post_status = 0 AND post_type='post' AND post_date < :postDate ORDER BY post_date DESC LIMIT 1", nativeQuery = true)
|
||||||
Post queryPrePost(Date postDate);
|
Post queryPrePost(@Param("postDate") Date postDate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询指定日期之后的文章
|
* 查询指定日期之后的文章
|
||||||
*
|
*
|
||||||
* @param postDate 日期
|
* @param postDate 日期
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM halo_post WHERE post_status = 0 AND post_type='post' AND post_date > :postDate ORDER BY post_date ASC LIMIT 1", nativeQuery = true)
|
@Query(value = "SELECT * FROM halo_post WHERE post_status = 0 AND post_type='post' AND post_date > :postDate ORDER BY post_date ASC LIMIT 1", nativeQuery = true)
|
||||||
Post queryNextPost(Date postDate);
|
Post queryNextPost(@Param("postDate") Date postDate);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文章归档信息 根据年份和月份
|
* 查询文章归档信息 根据年份和月份
|
||||||
|
@ -139,7 +134,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return List
|
* @return List
|
||||||
*
|
|
||||||
* @Author Aquan
|
* @Author Aquan
|
||||||
* @Description 查询文章归档信息 查询所有文章
|
* @Description 查询文章归档信息 查询所有文章
|
||||||
* @Date 2019.1.4 11:19
|
* @Date 2019.1.4 11:19
|
||||||
|
@ -150,7 +144,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Integer
|
* @return Integer
|
||||||
*
|
|
||||||
* @Author Aquan
|
* @Author Aquan
|
||||||
* @Description 查询文章总数
|
* @Description 查询文章总数
|
||||||
* @Date 2019.1.4 15:03
|
* @Date 2019.1.4 15:03
|
||||||
|
@ -165,7 +158,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
*
|
*
|
||||||
* @param year year
|
* @param year year
|
||||||
* @param month month
|
* @param month month
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT *,YEAR(post_date) AS YEAR,MONTH(post_date) AS MONTH FROM halo_post WHERE post_status=0 and post_type='post' AND YEAR(post_date)=:year AND MONTH(post_date)=:month ORDER BY post_date DESC", nativeQuery = true)
|
@Query(value = "SELECT *,YEAR(post_date) AS YEAR,MONTH(post_date) AS MONTH FROM halo_post WHERE post_status=0 and post_type='post' AND YEAR(post_date)=:year AND MONTH(post_date)=:month ORDER BY post_date DESC", nativeQuery = true)
|
||||||
|
@ -175,7 +167,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* 根据年份查询文章
|
* 根据年份查询文章
|
||||||
*
|
*
|
||||||
* @param year year
|
* @param year year
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT *,YEAR(post_date) AS YEAR FROM halo_post WHERE post_status=0 AND post_type='post' AND YEAR(post_date)=:year ORDER BY post_date DESC", nativeQuery = true)
|
@Query(value = "SELECT *,YEAR(post_date) AS YEAR FROM halo_post WHERE post_status=0 AND post_type='post' AND YEAR(post_date)=:year ORDER BY post_date DESC", nativeQuery = true)
|
||||||
|
@ -187,7 +178,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* @param year year
|
* @param year year
|
||||||
* @param month month
|
* @param month month
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM halo_post WHERE post_status=0 and post_type='post' AND YEAR(post_date)=:year AND MONTH(post_date)=:month ORDER BY post_date DESC", countQuery = "SELECT COUNT(*) FROM halo_post WHERE post_status=0 AND YEAR(post_date)=:year AND MONTH(post_date)=:month", nativeQuery = true)
|
@Query(value = "SELECT * FROM halo_post WHERE post_status=0 and post_type='post' AND YEAR(post_date)=:year AND MONTH(post_date)=:month ORDER BY post_date DESC", countQuery = "SELECT COUNT(*) FROM halo_post WHERE post_status=0 AND YEAR(post_date)=:year AND MONTH(post_date)=:month", nativeQuery = true)
|
||||||
|
@ -199,7 +189,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* @param category category
|
* @param category category
|
||||||
* @param status status
|
* @param status status
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostByCategoriesAndPostStatus(Category category, Integer status, Pageable pageable);
|
Page<Post> findPostByCategoriesAndPostStatus(Category category, Integer status, Pageable pageable);
|
||||||
|
@ -210,7 +199,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* @param tag tag
|
* @param tag tag
|
||||||
* @param status status
|
* @param status status
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostsByTagsAndPostStatus(Tag tag, Integer status, Pageable pageable);
|
Page<Post> findPostsByTagsAndPostStatus(Tag tag, Integer status, Pageable pageable);
|
||||||
|
@ -219,27 +207,14 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* 根据标签查询文章
|
* 根据标签查询文章
|
||||||
*
|
*
|
||||||
* @param tag tag
|
* @param tag tag
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> findPostsByTags(Tag tag);
|
List<Post> findPostsByTags(Tag tag);
|
||||||
|
|
||||||
/**
|
|
||||||
* 模糊查询文章
|
|
||||||
*
|
|
||||||
* @param keyword 关键词
|
|
||||||
* @param pageable 分页信息
|
|
||||||
*
|
|
||||||
* @return Page
|
|
||||||
*/
|
|
||||||
@Query(value = "SELECT * FROM halo_post WHERE post_status = 0 AND post_type='post' AND post_title LIKE '%=:keyword%' OR post_content LIKE '%=:keyword%'", nativeQuery = true)
|
|
||||||
Page<Post> findPostByPostTitleLikeOrPostContentLikeAndPostTypeAndPostStatus(String keyword, Pageable pageable);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按热度从大到小排序
|
* 按热度从大到小排序
|
||||||
*
|
*
|
||||||
* @param postStatus 文章状态
|
* @param postStatus 文章状态
|
||||||
*
|
|
||||||
* @return List<Post>
|
* @return List<Post>
|
||||||
*/
|
*/
|
||||||
List<Post> findPostsByPostTypeOrderByPostViewsDesc(String postStatus);
|
List<Post> findPostsByPostTypeOrderByPostViewsDesc(String postStatus);
|
||||||
|
@ -257,7 +232,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
*
|
*
|
||||||
* @param status 文章状态
|
* @param status 文章状态
|
||||||
* @param postType 文章类型
|
* @param postType 文章类型
|
||||||
*
|
|
||||||
* @return 文章数量
|
* @return 文章数量
|
||||||
*/
|
*/
|
||||||
Integer countAllByPostStatusAndPostType(Integer status, String postType);
|
Integer countAllByPostStatusAndPostType(Integer status, String postType);
|
||||||
|
@ -266,7 +240,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
|
||||||
* 获取指定条数的文章
|
* 获取指定条数的文章
|
||||||
*
|
*
|
||||||
* @param limit 条数
|
* @param limit 条数
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM halo_post WHERE post_status = 0 AND post_type = 'post' ORDER BY post_date DESC LIMIT :limit", nativeQuery = true)
|
@Query(value = "SELECT * FROM halo_post WHERE post_status = 0 AND post_type = 'post' ORDER BY post_date DESC LIMIT :limit", nativeQuery = true)
|
||||||
|
|
|
@ -26,7 +26,6 @@ public interface PostService {
|
||||||
* 新增文章
|
* 新增文章
|
||||||
*
|
*
|
||||||
* @param post Post
|
* @param post Post
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post save(Post post);
|
Post save(Post post);
|
||||||
|
@ -35,7 +34,6 @@ public interface PostService {
|
||||||
* 根据编号删除文章
|
* 根据编号删除文章
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post remove(Long postId);
|
Post remove(Long postId);
|
||||||
|
@ -45,7 +43,6 @@ public interface PostService {
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
* @param status status
|
* @param status status
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post updatePostStatus(Long postId, Integer status);
|
Post updatePostStatus(Long postId, Integer status);
|
||||||
|
@ -61,7 +58,6 @@ public interface PostService {
|
||||||
* 获取文章列表 不分页
|
* 获取文章列表 不分页
|
||||||
*
|
*
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> findAll(String postType);
|
List<Post> findAll(String postType);
|
||||||
|
@ -69,12 +65,13 @@ public interface PostService {
|
||||||
/**
|
/**
|
||||||
* 模糊查询文章
|
* 模糊查询文章
|
||||||
*
|
*
|
||||||
* @param keyWord keyword
|
* @param keyword 关键词
|
||||||
* @param pageable pageable
|
* @param postType 文章类型
|
||||||
*
|
* @param postStatus 文章状态
|
||||||
* @return List
|
* @param pageable 分页信息
|
||||||
|
* @return Page
|
||||||
*/
|
*/
|
||||||
List<Post> searchPosts(String keyWord, Pageable pageable);
|
Page<Post> searchPosts(String keyword, String postType, Integer postStatus, Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据文章状态查询 分页,用于后台管理
|
* 根据文章状态查询 分页,用于后台管理
|
||||||
|
@ -82,7 +79,6 @@ public interface PostService {
|
||||||
* @param status 0,1,2
|
* @param status 0,1,2
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
* @param pageable 分页信息
|
* @param pageable 分页信息
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable);
|
Page<Post> findPostByStatus(Integer status, String postType, Pageable pageable);
|
||||||
|
@ -91,7 +87,6 @@ public interface PostService {
|
||||||
* 根据文章状态查询 分页,首页分页
|
* 根据文章状态查询 分页,首页分页
|
||||||
*
|
*
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostByStatus(Pageable pageable);
|
Page<Post> findPostByStatus(Pageable pageable);
|
||||||
|
@ -101,7 +96,6 @@ public interface PostService {
|
||||||
*
|
*
|
||||||
* @param status 0,1,2
|
* @param status 0,1,2
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> findPostByStatus(Integer status, String postType);
|
List<Post> findPostByStatus(Integer status, String postType);
|
||||||
|
@ -110,7 +104,6 @@ public interface PostService {
|
||||||
* 根据编号查询文章
|
* 根据编号查询文章
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Optional<Post> findByPostId(Long postId);
|
Optional<Post> findByPostId(Long postId);
|
||||||
|
@ -120,7 +113,6 @@ public interface PostService {
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
* @param postType postType
|
* @param postType postType
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post findByPostId(Long postId, String postType);
|
Post findByPostId(Long postId, String postType);
|
||||||
|
@ -130,7 +122,6 @@ public interface PostService {
|
||||||
*
|
*
|
||||||
* @param postUrl 路径
|
* @param postUrl 路径
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post findByPostUrl(String postUrl, String postType);
|
Post findByPostUrl(String postUrl, String postType);
|
||||||
|
@ -146,7 +137,6 @@ public interface PostService {
|
||||||
* 获取下一篇文章 较新
|
* 获取下一篇文章 较新
|
||||||
*
|
*
|
||||||
* @param postDate postDate
|
* @param postDate postDate
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post getNextPost(Date postDate);
|
Post getNextPost(Date postDate);
|
||||||
|
@ -155,7 +145,6 @@ public interface PostService {
|
||||||
* 获取下一篇文章 较老
|
* 获取下一篇文章 较老
|
||||||
*
|
*
|
||||||
* @param postDate postDate
|
* @param postDate postDate
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
Post getPrePost(Date postDate);
|
Post getPrePost(Date postDate);
|
||||||
|
@ -176,7 +165,6 @@ public interface PostService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return List
|
* @return List
|
||||||
*
|
|
||||||
* @Author Aquan
|
* @Author Aquan
|
||||||
* @Description 查询归档信息 查看所有文章
|
* @Description 查询归档信息 查看所有文章
|
||||||
* @Date 2019.1.4 11:14
|
* @Date 2019.1.4 11:14
|
||||||
|
@ -190,7 +178,6 @@ public interface PostService {
|
||||||
*
|
*
|
||||||
* @param year year
|
* @param year year
|
||||||
* @param month month
|
* @param month month
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> findPostByYearAndMonth(String year, String month);
|
List<Post> findPostByYearAndMonth(String year, String month);
|
||||||
|
@ -201,7 +188,6 @@ public interface PostService {
|
||||||
* @param year year
|
* @param year year
|
||||||
* @param month month
|
* @param month month
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable);
|
Page<Post> findPostByYearAndMonth(String year, String month, Pageable pageable);
|
||||||
|
@ -210,7 +196,6 @@ public interface PostService {
|
||||||
* 根据年份查询文章
|
* 根据年份查询文章
|
||||||
*
|
*
|
||||||
* @param year year
|
* @param year year
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> findPostByYear(String year);
|
List<Post> findPostByYear(String year);
|
||||||
|
@ -220,7 +205,6 @@ public interface PostService {
|
||||||
*
|
*
|
||||||
* @param category category
|
* @param category category
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostByCategories(Category category, Pageable pageable);
|
Page<Post> findPostByCategories(Category category, Pageable pageable);
|
||||||
|
@ -230,21 +214,10 @@ public interface PostService {
|
||||||
*
|
*
|
||||||
* @param tag tag
|
* @param tag tag
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
Page<Post> findPostsByTags(Tag tag, Pageable pageable);
|
Page<Post> findPostsByTags(Tag tag, Pageable pageable);
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索文章
|
|
||||||
*
|
|
||||||
* @param keyword 关键词
|
|
||||||
* @param pageable 分页信息
|
|
||||||
*
|
|
||||||
* @return Page
|
|
||||||
*/
|
|
||||||
Page<Post> searchByKeywords(String keyword, Pageable pageable);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 热门文章
|
* 热门文章
|
||||||
*
|
*
|
||||||
|
@ -256,7 +229,6 @@ public interface PostService {
|
||||||
* 当前文章的相似文章
|
* 当前文章的相似文章
|
||||||
*
|
*
|
||||||
* @param post post
|
* @param post post
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> relatedPosts(Post post);
|
List<Post> relatedPosts(Post post);
|
||||||
|
@ -272,7 +244,6 @@ public interface PostService {
|
||||||
* 根据文章状态查询数量
|
* 根据文章状态查询数量
|
||||||
*
|
*
|
||||||
* @param status 文章状态
|
* @param status 文章状态
|
||||||
*
|
|
||||||
* @return 文章数量
|
* @return 文章数量
|
||||||
*/
|
*/
|
||||||
Integer getCountByStatus(Integer status);
|
Integer getCountByStatus(Integer status);
|
||||||
|
@ -281,7 +252,6 @@ public interface PostService {
|
||||||
* 生成rss
|
* 生成rss
|
||||||
*
|
*
|
||||||
* @param posts posts
|
* @param posts posts
|
||||||
*
|
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
String buildRss(List<Post> posts);
|
String buildRss(List<Post> posts);
|
||||||
|
@ -290,7 +260,6 @@ public interface PostService {
|
||||||
* 生成sitemap
|
* 生成sitemap
|
||||||
*
|
*
|
||||||
* @param posts posts
|
* @param posts posts
|
||||||
*
|
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
String buildSiteMap(List<Post> posts);
|
String buildSiteMap(List<Post> posts);
|
||||||
|
@ -308,7 +277,6 @@ public interface PostService {
|
||||||
* @param post post
|
* @param post post
|
||||||
* @param cateList cateList
|
* @param cateList cateList
|
||||||
* @param tagList tagList
|
* @param tagList tagList
|
||||||
*
|
|
||||||
* @return Post Post
|
* @return Post Post
|
||||||
*/
|
*/
|
||||||
Post buildCategoriesAndTags(Post post, List<String> cateList, @RequestParam("tagList") String tagList);
|
Post buildCategoriesAndTags(Post post, List<String> cateList, @RequestParam("tagList") String tagList);
|
||||||
|
@ -317,7 +285,6 @@ public interface PostService {
|
||||||
* 获取最近的文章
|
* 获取最近的文章
|
||||||
*
|
*
|
||||||
* @param limit 条数
|
* @param limit 条数
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
List<Post> getRecentPosts(int limit);
|
List<Post> getRecentPosts(int limit);
|
||||||
|
|
|
@ -57,7 +57,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 保存文章
|
* 保存文章
|
||||||
*
|
*
|
||||||
* @param post Post
|
* @param post Post
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -82,7 +81,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 根据编号移除文章
|
* 根据编号移除文章
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,7 +96,6 @@ public class PostServiceImpl implements PostService {
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
* @param status status
|
* @param status status
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -133,7 +130,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 获取文章列表 不分页
|
* 获取文章列表 不分页
|
||||||
*
|
*
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -145,14 +141,23 @@ public class PostServiceImpl implements PostService {
|
||||||
/**
|
/**
|
||||||
* 模糊查询文章
|
* 模糊查询文章
|
||||||
*
|
*
|
||||||
* @param keyWord keyword
|
* @param keyword 关键词
|
||||||
* @param pageable pageable
|
* @param postType 文章类型
|
||||||
*
|
* @param postStatus 文章状态
|
||||||
* @return List
|
* @param pageable 分页信息
|
||||||
|
* @return Page
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Post> searchPosts(String keyWord, Pageable pageable) {
|
public Page<Post> searchPosts(String keyword, String postType, Integer postStatus, Pageable pageable) {
|
||||||
return postRepository.findByPostTitleLike(keyWord, pageable);
|
return postRepository.findByPostTypeAndPostStatusAndPostTitleLikeOrPostTypeAndPostStatusAndPostContentLike(
|
||||||
|
postType,
|
||||||
|
postStatus,
|
||||||
|
"%" + keyword + "%",
|
||||||
|
postType,
|
||||||
|
postStatus,
|
||||||
|
"%" + keyword + "%",
|
||||||
|
pageable
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +166,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* @param status 0,1,2
|
* @param status 0,1,2
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
* @param pageable 分页信息
|
* @param pageable 分页信息
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -173,7 +177,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 根据文章状态查询 分页,首页分页
|
* 根据文章状态查询 分页,首页分页
|
||||||
*
|
*
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -187,7 +190,6 @@ public class PostServiceImpl implements PostService {
|
||||||
*
|
*
|
||||||
* @param status 0,1,2
|
* @param status 0,1,2
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -200,7 +202,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 根据编号查询文章
|
* 根据编号查询文章
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
*
|
|
||||||
* @return Optional
|
* @return Optional
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -212,7 +213,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 根据编号和类型查询文章
|
* 根据编号和类型查询文章
|
||||||
*
|
*
|
||||||
* @param postId postId
|
* @param postId postId
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -225,7 +225,6 @@ public class PostServiceImpl implements PostService {
|
||||||
*
|
*
|
||||||
* @param postUrl 路径
|
* @param postUrl 路径
|
||||||
* @param postType post or page
|
* @param postType post or page
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -249,7 +248,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 获取下一篇文章 较新
|
* 获取下一篇文章 较新
|
||||||
*
|
*
|
||||||
* @param postDate postDate
|
* @param postDate postDate
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -261,7 +259,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 获取下一篇文章 较老
|
* 获取下一篇文章 较老
|
||||||
*
|
*
|
||||||
* @param postDate postDate
|
* @param postDate postDate
|
||||||
*
|
|
||||||
* @return Post
|
* @return Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -314,7 +311,6 @@ public class PostServiceImpl implements PostService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return List
|
* @return List
|
||||||
*
|
|
||||||
* @Author Aquan
|
* @Author Aquan
|
||||||
* @Description 查询归档信息 返回所有文章
|
* @Description 查询归档信息 返回所有文章
|
||||||
* @Date 2019.1.4 11:16
|
* @Date 2019.1.4 11:16
|
||||||
|
@ -341,7 +337,6 @@ public class PostServiceImpl implements PostService {
|
||||||
*
|
*
|
||||||
* @param year year
|
* @param year year
|
||||||
* @param month month
|
* @param month month
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -354,7 +349,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 根据年份查询文章
|
* 根据年份查询文章
|
||||||
*
|
*
|
||||||
* @param year year
|
* @param year year
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -369,7 +363,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* @param year year year
|
* @param year year year
|
||||||
* @param month month month
|
* @param month month month
|
||||||
* @param pageable pageable pageable
|
* @param pageable pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -383,7 +376,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* @param category category
|
* @param category category
|
||||||
* @param status status
|
* @param status status
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -398,7 +390,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* @param tag tag
|
* @param tag tag
|
||||||
* @param status status
|
* @param status status
|
||||||
* @param pageable pageable
|
* @param pageable pageable
|
||||||
*
|
|
||||||
* @return Page
|
* @return Page
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -407,19 +398,6 @@ public class PostServiceImpl implements PostService {
|
||||||
return postRepository.findPostsByTagsAndPostStatus(tag, PostStatusEnum.PUBLISHED.getCode(), pageable);
|
return postRepository.findPostsByTagsAndPostStatus(tag, PostStatusEnum.PUBLISHED.getCode(), pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索文章
|
|
||||||
*
|
|
||||||
* @param keyword 关键词
|
|
||||||
* @param pageable 分页信息
|
|
||||||
*
|
|
||||||
* @return Page
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Page<Post> searchByKeywords(String keyword, Pageable pageable) {
|
|
||||||
return postRepository.findPostByPostTitleLikeOrPostContentLikeAndPostTypeAndPostStatus(keyword, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 热门文章
|
* 热门文章
|
||||||
*
|
*
|
||||||
|
@ -435,7 +413,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 当前文章的相似文章
|
* 当前文章的相似文章
|
||||||
*
|
*
|
||||||
* @param post post
|
* @param post post
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -473,7 +450,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 根据文章状态查询数量
|
* 根据文章状态查询数量
|
||||||
*
|
*
|
||||||
* @param status 文章状态
|
* @param status 文章状态
|
||||||
*
|
|
||||||
* @return 文章数量
|
* @return 文章数量
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -485,7 +461,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 生成rss
|
* 生成rss
|
||||||
*
|
*
|
||||||
* @param posts posts
|
* @param posts posts
|
||||||
*
|
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -503,7 +478,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 生成sitemap
|
* 生成sitemap
|
||||||
*
|
*
|
||||||
* @param posts posts
|
* @param posts posts
|
||||||
*
|
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -531,7 +505,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* @param post post
|
* @param post post
|
||||||
* @param cateList cateList
|
* @param cateList cateList
|
||||||
* @param tagList tagList
|
* @param tagList tagList
|
||||||
*
|
|
||||||
* @return Post Post
|
* @return Post Post
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -549,7 +522,6 @@ public class PostServiceImpl implements PostService {
|
||||||
* 获取最近的文章
|
* 获取最近的文章
|
||||||
*
|
*
|
||||||
* @param limit 条数
|
* @param limit 条数
|
||||||
*
|
|
||||||
* @return List
|
* @return List
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,7 +18,6 @@ import cc.ryanc.halo.web.controller.core.BaseController;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HtmlUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||||
|
@ -121,7 +120,7 @@ public class PostController extends BaseController {
|
||||||
//排序规则
|
//排序规则
|
||||||
final Sort sort = new Sort(Sort.Direction.DESC, "postId");
|
final Sort sort = new Sort(Sort.Direction.DESC, "postId");
|
||||||
final Pageable pageable = PageRequest.of(page, size, sort);
|
final Pageable pageable = PageRequest.of(page, size, sort);
|
||||||
model.addAttribute("posts", postService.searchPosts(keyword, pageable));
|
model.addAttribute("posts", postService.searchPosts(keyword,PostTypeEnum.POST_TYPE_POST.getDesc(),PostStatusEnum.PUBLISHED.getCode(),pageable));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("未知错误:{}", e.getMessage());
|
log.error("未知错误:{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -45,7 +44,6 @@ public class FrontIndexController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String index(Model model) {
|
public String index(Model model) {
|
||||||
//调用方法渲染首页
|
|
||||||
return this.index(model, 1);
|
return this.index(model, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,23 +71,9 @@ public class FrontIndexController extends BaseController {
|
||||||
return this.renderNotFound();
|
return this.renderNotFound();
|
||||||
}
|
}
|
||||||
final int[] rainbow = PageUtil.rainbow(page, posts.getTotalPages(), 3);
|
final int[] rainbow = PageUtil.rainbow(page, posts.getTotalPages(), 3);
|
||||||
model.addAttribute("is_index",true);
|
model.addAttribute("is_index", true);
|
||||||
model.addAttribute("posts", posts);
|
model.addAttribute("posts", posts);
|
||||||
model.addAttribute("rainbow", rainbow);
|
model.addAttribute("rainbow", rainbow);
|
||||||
return this.render("index");
|
return this.render("index");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 搜索文章
|
|
||||||
*
|
|
||||||
* @param keyword keyword
|
|
||||||
* @param model model
|
|
||||||
* @return 模板路径/themes/{theme}/index
|
|
||||||
*/
|
|
||||||
@GetMapping(value = "search")
|
|
||||||
public String search(@RequestParam("keyword") String keyword, Model model) {
|
|
||||||
final Page<Post> posts = postService.searchByKeywords(keyword, null);
|
|
||||||
model.addAttribute("posts", posts);
|
|
||||||
return this.render("index");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package cc.ryanc.halo.web.controller.front;
|
||||||
|
|
||||||
|
import cc.ryanc.halo.model.domain.Post;
|
||||||
|
import cc.ryanc.halo.model.dto.HaloConst;
|
||||||
|
import cc.ryanc.halo.model.enums.BlogPropertiesEnum;
|
||||||
|
import cc.ryanc.halo.model.enums.PostStatusEnum;
|
||||||
|
import cc.ryanc.halo.model.enums.PostTypeEnum;
|
||||||
|
import cc.ryanc.halo.service.PostService;
|
||||||
|
import cc.ryanc.halo.web.controller.core.BaseController;
|
||||||
|
import cn.hutool.core.util.PageUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 文章检索
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author : RYAN0UP
|
||||||
|
* @date : 2019/1/11
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RequestMapping(value = "/search")
|
||||||
|
public class FrontSearchController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PostService postService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章检索
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
* @param keyword 关键词
|
||||||
|
* @return 模板路径/themes/{theme}/search
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
public String search(Model model,
|
||||||
|
@RequestParam(value = "keyword") String keyword) {
|
||||||
|
return this.search(model, keyword, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章检索 分页
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
* @param keyword 关键词
|
||||||
|
* @param page 当前页码
|
||||||
|
* @return 模板路径/themes/{theme}/search
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "page/{page}")
|
||||||
|
public String search(Model model,
|
||||||
|
@RequestParam(value = "keyword") String keyword,
|
||||||
|
@PathVariable(value = "page") Integer page) {
|
||||||
|
final Sort sort = new Sort(Sort.Direction.DESC, "postDate");
|
||||||
|
int size = 10;
|
||||||
|
if (StrUtil.isNotBlank(HaloConst.OPTIONS.get(BlogPropertiesEnum.INDEX_POSTS.getProp()))) {
|
||||||
|
size = Integer.parseInt(HaloConst.OPTIONS.get(BlogPropertiesEnum.INDEX_POSTS.getProp()));
|
||||||
|
}
|
||||||
|
final Pageable pageable = PageRequest.of(page - 1, size, sort);
|
||||||
|
final Page<Post> posts = postService.searchPosts(keyword,PostTypeEnum.POST_TYPE_POST.getDesc(),PostStatusEnum.PUBLISHED.getCode(),pageable);
|
||||||
|
final int[] rainbow = PageUtil.rainbow(page, posts.getTotalPages(), 3);
|
||||||
|
model.addAttribute("is_search", true);
|
||||||
|
model.addAttribute("keyword", keyword);
|
||||||
|
model.addAttribute("posts", posts);
|
||||||
|
model.addAttribute("rainbow", rainbow);
|
||||||
|
return this.render("search");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable" method="post" action="">
|
<div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable" method="post" action="">
|
||||||
<label id="search-label" class="mdl-button mdl-js-ripple-effect mdl-js-button mdl-button--fab mdl-color--accent mdl-shadow--4dp" for="search">
|
<label id="search-label" class="mdl-button mdl-js-ripple-effect mdl-js-button mdl-button--fab mdl-color--accent mdl-shadow--4dp" for="search">
|
||||||
<i class="material-icons mdl-color-text--white" role="presentation">search</i>
|
<i class="material-icons mdl-color-text--white" role="presentation">search</i>
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
<#include "module/macro.ftl">
|
||||||
|
<@layout title="搜索:${keyword} | ${options.blog_title!'Material'}" keywords="${options.seo_keywords!'Material'}}" description="${options.seo_desc!'Material'}}">
|
||||||
|
<!-- Index Module -->
|
||||||
|
<div class="material-index mdl-grid">
|
||||||
|
<#if (options.theme_material_scheme!'Paradox') == "Paradox" && posts.number==0 && !isArchives??>
|
||||||
|
<!-- Paradox Header -->
|
||||||
|
<#include "_partial/daily_pic.ftl">
|
||||||
|
<#include "_partial/blog_info.ftl">
|
||||||
|
</#if>
|
||||||
|
<div class="locate-thumbnail-symbol"></div>
|
||||||
|
<!-- Pin on top -->
|
||||||
|
|
||||||
|
<!-- Normal Post -->
|
||||||
|
<#if (options.theme_material_scheme!'Paradox') == "Paradox">
|
||||||
|
<!-- Paradox Thumbnail -->
|
||||||
|
<#include "_partial/Paradox-post_entry.ftl">
|
||||||
|
<#else>
|
||||||
|
<!-- Isolation Thumbnail -->
|
||||||
|
<#include "_partial/Isolation-post_entry.ftl">
|
||||||
|
</#if>
|
||||||
|
<#if posts.totalPages gt 1 >
|
||||||
|
<nav class="material-nav mdl-cell mdl-cell--12-col">
|
||||||
|
<#if posts.hasPrevious()>
|
||||||
|
<#if posts.number == 1>
|
||||||
|
<a class="extend prev" rel="prev" href="/search?keyword=${keyword}">
|
||||||
|
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
|
||||||
|
<i class="material-icons" role="presentation">arrow_back</i>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
<#else >
|
||||||
|
<a class="extend prev" rel="prev" href="/search/page/${posts.number}?keyword=${keyword}">
|
||||||
|
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
|
||||||
|
<i class="material-icons" role="presentation">arrow_back</i>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
</#if>
|
||||||
|
</#if>
|
||||||
|
<span class="page-number current">${posts.number+1}</span>
|
||||||
|
<#if posts.hasNext()>
|
||||||
|
<a class="extend next" rel="next" href="/search/page/${posts.number+2}?keyword=${keyword}">
|
||||||
|
<button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
|
||||||
|
<i class="material-icons" role="presentation">arrow_forward</i>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
</#if>
|
||||||
|
</nav>
|
||||||
|
</#if>
|
||||||
|
<#if (options.theme_material_scheme!'Paradox') == "Paradox">
|
||||||
|
<#include "_partial/Paradox-post_entry-thumbnail.ftl">
|
||||||
|
</#if>
|
||||||
|
</div>
|
||||||
|
</@layout>
|
Loading…
Reference in New Issue