Skip to content

Commit

Permalink
feat: layout post
Browse files Browse the repository at this point in the history
  • Loading branch information
akijoey committed Feb 6, 2021
1 parent a8e9291 commit 157f71b
Show file tree
Hide file tree
Showing 17 changed files with 180 additions and 632 deletions.
8 changes: 0 additions & 8 deletions layout/category.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,3 @@ extends layout/layout.pug

block content
include partial/article.pug
//- include utils/mixins.pug
//- #category
//- .article-sort-title= _p('page.category') + ' - ' + page.category
//- +articleSort(page.posts)
//- include partial/pagination.pug
//- #aside_content.aside_content
//- include partial/aside.pug
2 changes: 1 addition & 1 deletion layout/layout/content.pug
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ main
i.fa.fa-arrow-up#go-up(aria-hidden="true")
section#rightside.rightside
if theme.readmode.enable && is_post()
i#readmode.fa.fa-book(title=_p('rightside.readmode_title'))
i#readmode.fa.fa-book(title=_p('rightside.readmode_title'))
i#font_plus.fa.fa-plus(title=_p('rightside.font_plus_title'))
i#font_minus.fa.fa-minus(title=_p('rightside.font_minus_title'))
if theme.translate && theme.translate.enable
Expand Down
34 changes: 16 additions & 18 deletions layout/layout/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ html(lang=config.language)
//- favicon
!= favicon_tag(config.favicon || theme.favicon || '/favicon.ico')

//- cdn styles
if theme.cdn.css !== undefined
each url in theme.cdn.css
link(rel='stylesheet', href=url)

//- local styles
if theme.styles !== undefined && theme.styles.length > 0
each url in theme.styles
link(rel='stylesheet', href=url_for(url))
//- styles
if theme.styles !== undefined
if theme.styles.remote !== undefined && theme.styles.remote.length > 0
each url in theme.styles.remote
link(rel='stylesheet' href=url)
if theme.styles.local !== undefined && theme.styles.local.length > 0
each url in theme.styles.local
link(rel='stylesheet' href=url_for(url))

include additional-head.pug

Expand All @@ -39,14 +38,13 @@ html(lang=config.language)
include content.pug
include footer.pug

//- cdn scripts
if theme.cdn.js !== undefined
each url in theme.cdn.js
script(src=url)

//- local scripts
if theme.scripts !== undefined && theme.scripts.length > 0
each url in theme.scripts
script(src=url_for(url))
//- scripts
if theme.scripts !== undefined
if theme.scripts.remote !== undefined && theme.scripts.remote.length > 0
each url in theme.scripts.remote
script(src=url)
if theme.scripts.local !== undefined && theme.scripts.local.length > 0
each url in theme.scripts.local
script(src=url_for(url))

include additional-js.pug
27 changes: 0 additions & 27 deletions layout/page.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ block content
if page.comments !== false
include partial/comment.pug


else if page.type === 'categories'
#post-content.category-content
.category-lists
Expand All @@ -21,31 +20,5 @@ block content
if page.comments !== false
include partial/comment.pug


//- games page
//- else if page.type === 'games'
//- each game, index in games
//- a(href=url_for(game.path))
//- img.post_bg.lozad(data-src='/img/page_img/' + game.title + '.png' title=game.title)
//- .card-item
//- if index % 2 == 0
//- .card-img.card-left
//- a(href=url_for(game.path))
//- img.post_bg.lozad(data-src='/img/page_img/' + game.title + '.png' title=game.title)
//- else
//- .card-img.card-right
//- a(href=url_for(game.path))
//- img.post_bg.lozad(data-src='/img/page_img/' + game.title + '.png' title=game.title)
//- .card-info
//- a(href=url_for(game.path) title=game.title)= game.title
else
#page!= page.content
//- article#page
//- h1= page.title
//- .article-container!= page.content
//- include partial/pagination.pug
//- if page.comments !== false
//- include partial/comment.pug
//- #aside_content.aside_content
//- include partial/aside.pug
32 changes: 13 additions & 19 deletions layout/partial/comment.pug
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
if theme.gitalk && theme.gitalk.enable
//- hr
#post-comment
.comment_headling
i.fa.fa-comments.fa-fw(aria-hidden="true")
=" "
span= _p('comment')
#gitalk-container
script.
var gitalk = new Gitalk({
clientID: '!{theme.gitalk.client_id}',
clientSecret: '!{theme.gitalk.client_secret}',
repo: '!{theme.gitalk.repo}',
owner: '!{theme.gitalk.owner}',
admin: '!{theme.gitalk.admin}',
id: md5(decodeURI(location.pathname)),
language: '!{lang}'
})
gitalk.render('gitalk-container')
if page.comments !== false
#comment
script.
var gitalk = new Gitalk({
clientID: '!{theme.gitalk.client_id}',
clientSecret: '!{theme.gitalk.client_secret}',
repo: '!{theme.gitalk.repo}',
owner: '!{theme.gitalk.owner}',
admin: '!{theme.gitalk.admin}',
id: md5(decodeURI(location.pathname)),
language: '!{lang}'
})
gitalk.render('comment')
72 changes: 20 additions & 52 deletions layout/partial/pagination.pug
Original file line number Diff line number Diff line change
@@ -1,56 +1,24 @@
-
var options = {
prev_text: '<i class="fa fa-chevron-left" aria-hidden="true"></i>',
next_text: '<i class="fa fa-chevron-right" aria-hidden="true"></i>',
mid_size: 1
const options = {
prev_text: '<i class="fas fa-chevron-left fa-fw"></i>',
next_text: '<i class="fas fa-chevron-right fa-fw"></i>',
mid_size: 1,
escape: false
}
if(!is_post())
#pagination
div.pagination
!=paginator(options)
else
#pagination.pagination_post
if(page.prev)
if(page.next)
.prev-post.pull-left
- var pagination_cover = page.prev.cover || theme.default_cover
a(href=url_for(page.prev.path))
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'` )
.label=_p('pagination.prev')
.prev_info
//- i.fa.fa-chevron-left
span=page.prev.title
else
.prev-post.pull-full
- var pagination_cover = page.prev.cover || theme.default_cover
a(href=url_for(page.prev.path))
img.prev_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.prev')
.prev_info
//- i.fa.fa-chevron-left
span=page.prev.title



if(page.next)
if(page.prev)
.next-post.pull-right
- var pagination_cover = page.next.cover || theme.default_cover
a(href=url_for(page.next.path))
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.next')
.next_info
span=page.next.title
//- i.fa.fa-chevron-right
else
.next-post.pull-full
- var pagination_cover = page.next.cover || theme.default_cover
a(href=url_for(page.next.path))
img.next_cover.lozad(data-src=`${pagination_cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
.label=_p('pagination.next')
.next_info
span=page.next.title
//- i.fa.fa-chevron-right
mixin pagination(direction)
div(id=`pagination-${direction}`)
a(href=url_for(page[direction].path))
- const cover = page[direction].cover || theme.default_cover
img.lozad(data-src=`${cover}` onerror=`onerror=null;src='${theme.lodding_bg.post_page}'`)
span= _p(`pagination.${direction}`)
span= page[direction].title

#pagination
if is_post()
if page.prev
+pagination('prev')
if page.next
+pagination('next')
else
!= paginator(options)
65 changes: 0 additions & 65 deletions layout/partial/reward.pug

This file was deleted.

5 changes: 0 additions & 5 deletions layout/partial/share.pug

This file was deleted.

47 changes: 22 additions & 25 deletions layout/post.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,28 @@ extends layout/layout.pug

block content
article#post.card
//- todo
#post-content.article-container!= page.content
if (theme.post_copyright && theme.post_copyright.enable)
.post-copyright
.post-copyright__author
span.post-copyright-meta= _p('post.copyright.author') + ": "
span.post-copyright-info
a(href=`mailto:${config.email}`) #[=config.author]
.post-copyright__type
span.post-copyright-meta= _p('post.copyright.link') + ": "
span.post-copyright-info
a(href=url_for(page.permalink)) #[=page.permalink]
.post-copyright__notice
span.post-copyright-meta= _p('post.copyright.copyright_notice') + ": "
span.post-copyright-info!= _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title)

#post-copyright
.post-copyright-item
title= _p('post.copyright.author') + ": "
a(href=`mailto:${config.email}`)= config.author
.post-copyright-item
title= _p('post.copyright.link') + ": "
a(href=url_for(page.permalink))= page.permalink
.post-copyright-item
title= _p('post.copyright.copyright_notice') + ": "
span!= _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title)

.tag_share
if (theme.post_meta.tags)
.post-meta__tag-list
each item, index in page.tags.data
a(href=url_for(item.path)).post-meta__tags #[=item.name]
include partial/share.pug

if theme.reward.enable
include partial/reward.pug
include partial/pagination.pug
#post-share
#post-share-tags
each tag in page.tags.data
a(href=url_for(tag.path))= tag.name
#post-share-social
.social-share(data-image= page.cover || theme.avatar data-sites= theme.sharejs.sites)
link(rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js@1.0.16/dist/css/share.min.css")
script(src="https://cdn.jsdelivr.net/npm/social-share.js@1.0.16/dist/js/social-share.min.js")

if page.comments !== false
include partial/comment.pug
include partial/pagination.pug
include partial/comment.pug
7 changes: 0 additions & 7 deletions layout/tag.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,3 @@ extends layout/layout.pug

block content
include partial/article.pug
//- include utils/mixins.pug
//- #tag
//- .article-sort-title= _p('page.tag') + ' - ' + page.tag
//- +articleSort(page.posts)
//- include partial/pagination.pug
//- #aside_content.aside_content
//- include partial/aside.pug
24 changes: 0 additions & 24 deletions layout/utils/variables.pug
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,3 @@
page.type = 'archive'
else if (is_post())
page.type = 'post'
var games = [
{
title: 'th1',
path: 'games/th1/th1.html'
},
{
title: 'th2',
path: 'games/th2/th2.html'
},
{
title: 'th3',
path: 'games/th3/th3.html'
},
{
title: 'th4',
path: 'games/th4/th4.html'
},
{
title: 'th5',
path: 'games/th5/th5.html'
}
]
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
"url": "https://github.com/akijoey/hexo-theme-lotus/issues"
},
"homepage": "https://github.com/akijoey/hexo-theme-lotus#readme",
"dependencies": {
"hexo-renderer-pug": "^1.0.0",
"hexo-renderer-rollup": "^0.0.4",
"hexo-renderer-stylus": "^2.0.1"
},
"devDependencies": {
"@akijoey/eslint-config": "latest",
"@akijoey/prettier-config": "latest",
Expand Down

0 comments on commit 157f71b

Please sign in to comment.