提交 ced54c94 编写于 作者: EvanOne(文一)'s avatar EvanOne(文一)

refactor: Show all content & show gallery in post list

refactor: Update
上级 4e9ed12f
div.post-gallery(itemscope itemtype="http://schema.org/ImageGallery")
each photo in page.photos
img(src=url_for(photo) itemprop="contentUrl").post-g-img
section#recent-posts
include ../_mixins/gallery.pug
- var postLists = theme.post_list.paginate.home ? page.posts : site.posts
- postLists.each(function (post) {
article.post-item
article(class=`${post.link ? 'post-link' : ''}`).post-item
+postHeader(post)
if !post.link
if theme.post_list.cover_image.home && post.top_image
img(src=post.top_image)
if post.top
include ./sticky-top.pug
if post.top
include ./sticky-top.pug
if theme.post_list.cover_image.home && post.top_image
img(src=post.top_image)
if post.photos && post.photos.length
+gallery(post)
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(post.content)
- var excerpt = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? excerpt += '......' : ''
div!= excerpt
else if post.excerpt
div.post-excerpt!= post.excerpt
else
div.post-excerpt!= post.content
if theme.auto_excerpt && theme.auto_excerpt.enable
- const content = strip_html(post.content)
- var excerpt = content.substring(0, theme.auto_excerpt.length)
- content.length > theme.auto_excerpt.length ? excerpt += '......' : ''
div!= excerpt
else
div.post-excerpt!= post.excerpt
if !post.link
div.post-btn
a(href=url_for(post.path))= _p("post.read_more") + " »"
- })
mixin gallery(post)
div.post-gallery(itemscope itemtype="http://schema.org/ImageGallery")
each photo in post.photos
img(src=url_for(photo) itemprop="contentUrl").post-g-img
......@@ -7,7 +7,7 @@ mixin postHeader(post)
a(href=url_for(post.link) target="_blank").post-title-wrapper
h1.post-title= post.title || post.link
else
a(href=url_for(post.canonical_path)).post-title-wrapper
a(href=url_for(post.path)).post-title-wrapper
h1.post-title= post.title || _p("post.untitled")
if !post.link
......
extends ./_common/layout.pug
block content
include ./_mixins/gallery.pug
if (page.title === "tags")
div.content.tag-cloud
if page.photos && page.photos.length
include ./_components/gallery.pug
+gallery(page)
div.tag-cloud-title= _p("page.tags") + " - "
span.tag-cloud-num= site.tags.length
......@@ -16,7 +18,7 @@ block content
else if (page.title === "categories")
div.content.category
if page.photos && page.photos.length
include ./_components/gallery.pug
+gallery(page)
div.category-title= _p("page.categories") + " - "
span.category-num= site.categories.length
......@@ -24,12 +26,12 @@ block content
else if (page.title === "about")
div.content.headings.code-highlight
if page.photos && page.photos.length
include ./_components/gallery.pug
+gallery(page)
!= page.content
else
div.content.headings.code-highlight
if page.photos && page.photos.length
include ./_components/gallery.pug
+gallery(page)
!= page.content
......@@ -2,13 +2,14 @@ extends ./_common/layout.pug
block content
include ./_mixins/post-header.pug
include ./_mixins/gallery.pug
div.content.headings.code-highlight
+postHeader(page)
div.post-body
if page.photos && page.photos.length
include ./_components/gallery.pug
+gallery(page)
!= page.content
......
$external-link-icon-color = convert(hexo-config('external_link.icon.color') || '#aaa')
.external-link
margin: 0 1px 0 3px
margin: 0 .1em 0 .2em
font-size: .9em
color: $external-link-icon-color
#recent-posts
.post-header
margin-bottom: 1.5rem
.post-header
margin-bottom: 1.5rem
.post-excerpt
margin-bottom: 2em
.post-item
position: relative
margin: 0 0 1.5rem
border-radius: 5px
padding: 1.5rem 2rem
width: 100%
background-color: $white
& > :first-child,
.post-excerpt > :first-child
margin-top: 0
& > :last-child,
.post-excerpt > :last-child
margin-bottom: 0
.sticky-top
top: 1rem
.post-btn
display: flex
a
clearAStyle()
display: inline-block
margin: 0 auto
border-radius: 5px
padding: 0 .6em
text-align: center
color: $white
background-color: $home-post-read-more-color
transition: background-color .2s ease
cursor: pointer
.post-excerpt
margin-bottom: 2em
&:hover
background-color: $home-post-read-more-hover-color
.post-item
position: relative
margin: 0 0 1.5rem
border-radius: 5px
padding: 1.5rem 2rem
width: 100%
background-color: $white
& > :first-child,
.post-excerpt > :first-child
margin-top: 0
& > :last-child,
.post-excerpt > :last-child
margin-bottom: 0
.sticky-top
top: 1rem
.post-btn
display: flex
a
clearAStyle()
display: inline-block
margin: 0 auto
border-radius: 5px
padding: 0 .6em
text-align: center
color: $white
background-color: $home-post-read-more-color
transition: background-color .2s ease
cursor: pointer
&:hover
background-color: $home-post-read-more-hover-color
.post-link
.post-header
margin: 0 0 .5rem
.post-title-wrapper
margin: 0
......@@ -5,7 +5,8 @@
.post-title-wrapper
display: inline-block
position: relative
border: 0
margin: 0 0 1rem
border-width: 0
word-wrap: break-word
color: $post-info-title-color
......@@ -14,7 +15,7 @@
.post-title
display: inline-block
margin: 0 0 1rem
margin: 0
font-size: $font-post-title
cursor: auto
......@@ -66,9 +67,4 @@
color: $post-info-reading-count-color
.external-link
font-size: .6em
#recent-posts
.post-header
margin-bottom: 2em
padding: 0
font-size: 1.5em
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册