Add: about 页面,优化其他页面样式

This commit is contained in:
XPoet 2020-03-19 18:11:13 +08:00
parent 00b471ed4a
commit 7b2625d11b
17 changed files with 103 additions and 596 deletions

View File

@ -1,7 +1,7 @@
menu:
Home: /
Archives: /archives
About: /adout
About: /about
rss: /atom.xml
favicon: images/favicon.png

12
layout/common/about.ejs Normal file
View File

@ -0,0 +1,12 @@
<% if(page.title == 'about') { %>
<div class="about-container">
<div class="about-content">
<%- page.content %>
</div>
<div class="about-comments">
<%if (page.comments) {%>
<%- partial('valine') %>
<%}%>
</div>
</div>
<% } %>

View File

@ -1,11 +1,10 @@
<!-- 归档页面 内容 -->
<% if (is_archive()) { %>
<!-- 如果是归档页面,将网站所有文章列出来,否则列出其他页(分类,标签)下的文章 -->
<% const posts = is_archive() ? site.posts : page.posts %>
<div class="archive-container">
<!-- 把所有文章按年份分类显示 -->
<% let last; %>
<% site.posts.each(function(post, i){ %>
<% posts.each(function(post, i){ %>
<% let year = post.date.year(); %>
<% if (last != year) { %>
<% if (last != null){ %>
@ -23,20 +22,11 @@
<span class="archive-article-date"> <%= date(post.date, 'MM-DD') %> </span>
</div>
<% }) %>
<% if (site.posts.length){ %>
<% if (posts.length){ %>
</div>
</section>
<% } %>
</div>
<% } %>

View File

@ -1,6 +1,6 @@
<!-- is_post() 检查当前页面是否为文章 -->
<% if (is_post()) { %>
<div class="post">
<div class="article-container">
<div class="post-title">
<h3><a><%= page.title %></a></h3>
</div>
@ -14,7 +14,7 @@
<span>
<i class="fa fa-list"></i>
<% page.categories.forEach(category => { %>
<a href="<%- url_for(category.path) %>" rel="tag"><%= category.name %></a>
<a href="<%- url_for(category.path) %>" rel="category"><%= category.name %></a>
<% }) %>
</span>
<span>
@ -28,6 +28,12 @@
<div class="post-content">
<%- page.content %>
</div>
<!-- TODO: 上一篇,下一篇 -->
<!--<div class="post-prev-next">
<a class="prev btn" rel="prev" role="navigation" href="/">上一篇</a>
<a class="next btn" rel="next" role="navigation" href="/">下一篇</a>
</div>-->
<div class="comment-container">
<%- partial('valine') %>
</div>

View File

@ -1,20 +1,10 @@
<h1>分页页面</h1>
<!--
is_category() 检查当前页面是否为分类归档页面。
如果给定一个字符串作为参数,将会检查目前是否为指定分类。
-->
<h2>当前分类:<%= page.category %></h2>
<% if (is_category()) { %>
<ul class="category-container">
<!-- page.posts 获取当前分类下的所有文章 -->
<% page.posts.forEach(post => { %>
<li class="category-item">
<div> 文章标题:<%= post.title %> </div>
<div> 建立日期:<%= date(post.date, 'YYYY-MM-DD HH:MM:SS') %> </div>
<div> 更新日期:<%= date(post.updated, 'YYYY-MM-DD HH:MM:SS') %> </div>
<div> 页面摘要:<%= post.excerpt ? post.excerpt : '无摘要' %> </div>
</li>
<% }) %>
</ul>
<div class="category-container">
<div class="category-name"><%- __('category') %><%= page.category %> [共<%= page.posts.length %>篇]</div>
</div>
<%- partial('archive-post') %>
<% } %>

View File

@ -1,6 +1,6 @@
<div class="article-post">
<!-- 检查当前页面是否为存档页面 -->
<% if (!is_archive()) { %>
<div class="home-container">
<!-- 检查当前页面是否为首页 -->
<% if (is_home()) { %>
<ul class="article-post-list">
<% page.posts.forEach(post => { %>
<li class="article-post-item">

View File

@ -1,20 +1,10 @@
<h1>标签页面</h1>
<!--
is_tag() 检查当前页面是否为标签归档页面。
is_tag('hobby') 如果给定一个字符串作为参数,将会检查目前是否为指定标签。
-->
<h2>当前标签:<%= page.tag %></h2>
<% if (is_tag()) { %>
<ul class="tag-container">
<!-- page.posts 获取当前分类下的所有文章 -->
<% page.posts.forEach(post => { %>
<li class="tag-item">
<div> 文章标题:<%= post.title %> </div>
<div> 建立日期:<%= date(post.date, 'YYYY-MM-DD HH:MM:SS') %> </div>
<div> 更新日期:<%= date(post.updated, 'YYYY-MM-DD HH:MM:SS') %> </div>
<div> 页面摘要:<%= post.excerpt ? post.excerpt : '无摘要' %> </div>
</li>
<% }) %>
</ul>
<div class="tag-container">
<div class="tag-name"><%- __('tag') %><%= page.tag %> [共<%= page.posts.length %>篇]</div>
</div>
<%- partial('archive-post') %>
<% } %>

View File

@ -22,6 +22,10 @@
<% } else if (is_tag()) { %>
<!-- 载入标签页面的内容 -->
<%- partial('common/tag-post') %>
<% } else if (page.title == 'about') { %>
<!-- 载入关于页面的内容 -->
<%- partial('common/about') %>
<% } %>
</div>
</div>

View File

@ -1,514 +0,0 @@
.post-content .tip {
position: relative;
margin: 2em 0;
padding: 12px 24px 12px 30px;
border-left: 4px solid #f66;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
background-color: #f8f8f8
}
.post-content .tip br {
/**display: none**/
}
.post-content .tip:before {
position: absolute;
top: 14px;
left: -12px;
content: "!";
width: 20px;
height: 20px;
border-radius: 100%;
color: #fff;
font-size: 14px;
line-height: 20px;
font-weight: bold;
text-align: center;
background-color: #f66;
font-family: 'Dosis', 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif
}
.content > .post > .post-content > p {
word-wrap: break-word;
word-break: break-all;
}
#ds-thread, #disqus_thread, #cloud-tie-wrapper {
margin: 0 30px !important
}
pre {
font-size: 0.8em !important;
background-color: #f8f8f8 !important;
font-family: 'Roboto Mono', 'Lucida Console', 'Trebuchet MS', 'Courier New', Monaco, courier, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Jhenghei', 'Microsoft YaHei', monospace !important
}
figure.highlight {
position: relative !important;
margin: 1em 0 !important;
border-radius: 2px !important;
line-height: 1.1em !important;
background-color: #f8f8f8 !important;
overflow-x: auto !important
}
figure.highlight table, figure.highlight tr, figure.highlight td {
width: 100% !important;
border-collapse: collapse !important;
padding: 0 !important;
margin: 0 !important
}
figure.highlight .gutter {
display: none !important
}
figure.highlight .code pre {
padding: 1.2em 1.4em !important;
line-height: 1.5em !important;
margin: 0 !important
}
figure.highlight.html .code:after, figure.highlight.js .code:after, figure.highlight.bash .code:after, figure.highlight.css .code:after, figure.highlight.scss .code:after, figure.highlight.diff .code:after, figure.highlight.java .code:after, figure.highlight.xml .code:after, figure.highlight.python .code:after, figure.highlight.json .code:after, figure.highlight.swift .code:after, figure.highlight.ruby .code:after, figure.highlight.perl .code:after, figure.highlight.php .code:after, figure.highlight.c .code:after, figure.highlight.cpp .code:after {
position: absolute !important;
top: 0 !important;
right: 0 !important;
color: #ccc !important;
text-align: right !important;
font-size: 0.75em !important;
padding: 5px 10px 0 !important;
line-height: 15px !important;
height: 15px !important;
font-weight: 600 !important
}
figure.highlight.html .code:after {
content: "HTML"
}
figure.highlight.js .code:after {
content: "JS"
}
figure.highlight.bash .code:after {
content: "BASH"
}
figure.highlight.css .code:after {
content: "CSS"
}
figure.highlight.scss .code:after {
content: "SCSS"
}
figure.highlight.diff .code:after {
content: "DIFF"
}
figure.highlight.java .code:after {
content: "JAVA"
}
figure.highlight.xml .code:after {
content: "XML"
}
figure.highlight.python .code:after {
content: "PYTHON"
}
figure.highlight.json .code:after {
content: "JSON"
}
figure.highlight.swift .code:after {
content: "SWIFT"
}
figure.highlight.ruby .code:after {
content: "RUBY"
}
figure.highlight.perl .code:after {
content: "PERL"
}
figure.highlight.php .code:after {
content: "PHP"
}
figure.highlight.c .code:after {
content: "C"
}
figure.highlight.java .code:after {
content: "JAVA"
}
figure.highlight.cpp .code:after {
content: "CPP"
}
figure.highlight.cpp .code:after {
content: 'C++'
}
pre {
color: #525252 !important
}
pre .function .keyword, pre .constant {
color: #0092db !important
}
pre .keyword, pre .attribute {
color: #e96900 !important
}
pre .number, pre .literal {
color: #ae81ff !important
}
pre .tag, pre .tag .title, pre .change, pre .winutils, pre .flow, pre .lisp .title, pre .clojure .built_in, pre .nginx .title, pre .tex .special {
color: #2973b7 !important
}
pre .symbol, pre .symbol .string, pre .value, pre .regexp {
color: #42b983 !important
}
pre .title {
color: #83B917 !important
}
pre .tag .value, pre .string, pre .subst, pre .haskell .type, pre .preprocessor, pre .ruby .class .parent, pre .built_in, pre .sql .aggregate, pre .django .template_tag, pre .django .variable, pre .smalltalk .class, pre .javadoc, pre .django .filter .argument, pre .smalltalk .localvars, pre .smalltalk .array, pre .attr_selector, pre .pseudo, pre .addition, pre .stream, pre .envvar, pre .apache .tag, pre .apache .cbracket, pre .tex .command, pre .prompt {
color: #42b983 !important
}
pre .comment, pre .java .annotation, pre .python .decorator, pre .template_comment, pre .pi, pre .doctype, pre .shebang, pre .apache .sqbracket, pre .tex .formula {
color: #b3b3b3 !important
}
pre .deletion {
color: #BA4545 !important
}
pre .coffeescript .javascript, pre .javascript .xml, pre .tex .formula, pre .xml .javascript, pre .xml .vbscript, pre .xml .css, pre .xml .cdata {
opacity: 0.5 !important
}
html {
height: 100%;
max-height: 100%;
padding: 0;
margin: 0;
}
body {
padding: 0;
margin: 0;
line-height: 1.6em;
}
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
h1, h2, h3, h4, h5, h6 {
text-rendering: optimizeLegibility;
line-height: 1;
margin: 2rem 0;
}
h1 {
font-size: 2.1rem;
line-height: 1.2em;
}
h2 {
font-size: 1.9rem;
line-height: 1.2em;
}
h3 {
font-size: 1.75rem;
}
h4 {
font-size: 1.3rem;
}
h5 {
font-size: 1.3rem;
}
h6 {
font-size: 1.3rem;
}
img {
max-width: 100%;
height: auto;
}
p, ul, ol, dl {
margin: 1em 0;
}
ol ol, ul ul, ul ol, ol ul {
margin: 0.4em 0;
}
ul p, ol p, li p, .content li p, blockquote p, .content blockquote p,
.post blockquote p, .post li p {
margin: 0;
overflow: visible;
}
a img {
border: none;
}
dl dt {
float: left;
width: 180px;
overflow: hidden;
clear: left;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: bold;
margin-bottom: 1em;
}
dl dd {
margin-left: 200px;
margin-bottom: 1em;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #efefef;
margin: 3.2em 0;
padding: 0;
}
blockquote {
box-sizing: border-box;
margin: 1.6em 0 1.6em -2.2em;
padding: 0 0 0 1.6em;
border-left: #4a4a4a 0.4em solid;
}
blockquote p {
margin: 0.8em 0;
}
blockquote small {
display: inline-block;
margin: 0.8em 0 0.8em 1.5em;
font-size: 0.9em;
color: #ccc;
}
blockquote small:before {
content: '\2014 \00A0';
}
blockquote cite {
font-weight: bold;
}
blockquote cite a {
font-weight: normal;
}
mark {
background-color: #ffc336;
}
code, tt {
padding: 1px 3px;
font-family: Inconsolata, monospace, sans-serif;
font-size: 0.85em;
white-space: pre-wrap;
border: 1px solid #E3EDF3;
background: #f7f7f9;
color: #d14;
border-radius: 2px;
}
.toc {
border: 1px solid #f0f0f0;
margin-bottom: 20px;
padding: 10px 30px;
}
#fb_comments_container {
overflow: hidden;
margin: 0 auto;
}
#fb_comments_container #fb_comments {
list-style-type: none;
padding: 0;
}
#fb_comments_container #fb_comments h1 {
font-size: 1.3em;
}
#fb_comments_container #fb_comments h2 {
font-size: 1.2em;
}
#fb_comments_container #fb_comments h3 {
font-size: 1.1em;
}
#fb_comments_container #fb_comments h4, #fb_comments_container #fb_comments h5,
#fb_comments_container #fb_comments h6 {
font-size: 1.05em;
}
#fb_comments_container #fb_comments .comment {
position: relative;
padding: 25px 0;
border-bottom: 1px solid rgba(150, 150, 150, 0.2);
*border-bottom: 1px solid #f0f0f0;
}
#fb_comments_container #fb_comments .comment .avatar {
position: absolute;
top: 25px;
left: 0;
width: 50px;
float: left;
}
#fb_comments_container #fb_comments .comment .avatar img {
width: 48px;
border: none;
border-radius: 5px;
margin: 0;
}
#fb_comments_container #fb_comments .comment .comment_body,
#fb_comments_container #fb_comments .comment .c_content {
margin-left: 70px;
display: block;
}
#fb_comments_container #fb_comments .comment .comment_body p,
#fb_comments_container #fb_comments .comment .c_content p {
margin: 5px 0 15px 0;
padding: 0;
line-height: 1.8;
}
#fb_comments_container #fb_comments .comment .comment_body .author,
#fb_comments_container #fb_comments .comment .c_content .author {
line-height: 1.5em;
margin: 0;
padding: 0;
}
#fb_comments_container #fb_comments .comment .comment_body .author b,
#fb_comments_container #fb_comments .comment .c_content .author b {
color: #555;
}
#fb_comments_container #fb_comments .comment .comment_body .author small,
#fb_comments_container #fb_comments .comment .c_content .author small {
font-weight: normal;
padding-left: 10px;
font-size: 0.7em;
color: #666;
}
#fb_new_comment {
padding-bottom: 50px;
}
#fb_new_comment textarea {
border-radius: 5px;
height: 80px;
width: 98%;
padding: 5px;
font-size: 1em;
border: 1px solid rgba(150, 150, 150, 0.5);
*border: 1px solid #a8a8a8;
line-height: 1.5;
}
#fb_new_comment .comment_error {
color: red;
text-align: center;
display: block;
font-size: 0.8em;
padding-top: 1em;
}
#fb_new_comment .c_button:hover {
background: #E60900;
color: #fff;
text-decoration: none;
}
#fb_new_comment .c_button, #fb_new_comment #c_submit {
cursor: pointer;
font-family: "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
font-size: 1em;
line-height: 1.3em;
letter-spacing: 1px;
border-radius: 5px;
padding: 5px 5px 2px 5px;
}
#fb_new_comment .input_body {
margin-top: 10px;
}
#fb_new_comment .input_body ul {
list-style: none;
padding: 5px 0;
margin: auto 0;
}
#fb_new_comment .input_body ul li {
float: left;
margin-right: 2.2%;
*margin-right: 22px;
}
#fb_new_comment .input_body ul li label {
line-height: 1em;
}
#fb_new_comment .input_body ul li input {
border-radius: 5px;
border: 1px solid #ddd;
padding: 5px;
background: rgba(255, 255, 255, 0.5);
margin: 0 0 10px 0;
}
#SwfStore_farbox_0 {
height: 0;
overflow: hidden;
}
@media screen and (max-width: 320px) {
#fb_comments .c_content, #fb_comments .comment_body {
margin-left: 57px;
}
}

View File

@ -1,6 +1,4 @@
.archive-container {
background: #fff
padding 30px
.archives-wrap {
margin-bottom 20px

View File

@ -1,6 +1,4 @@
.post {
background-color: #fff;
padding: 30px;
.article-container {
.post-title {
h1 {
@ -135,4 +133,18 @@
}
.post-prev-next {
margin-bottom 60px
a.prev {
float left
}
a.next {
float right
}
}
}

View File

@ -0,0 +1,9 @@
.category-container {
.category-name {
color: #666
font-size 20px
font-weight bold
margin-bottom 10px
}
}

View File

@ -1,7 +1,4 @@
.article-post {
background: #fff
padding 30px
.home-container {
.article-post-list {

View File

@ -0,0 +1,9 @@
.tag-container {
.tag-name {
color: #666
font-size 20px
font-weight bold
margin-bottom 10px
}
}

View File

@ -14,5 +14,7 @@ nav-container-height = 60px;
}
.article-post-container {
background: #fff
padding 30px
}
}

View File

@ -9,6 +9,8 @@
@import "common/home-post.styl"
@import "common/archive-post.styl"
@import "common/article-post.styl"
@import "common/category-post.styl"
@import "common/tag-post.styl"
@import "common/site-info.styl"
@import "common/paginator.styl"
@import "highlight"

View File

@ -1,7 +1,7 @@
console.log('this is main.js');
(() => {
// 选择分页器元素里面的 a 标签,但不包含 .page-number给指定元素追加类 btn 和 设置属性 role=navigation
document.querySelectorAll('.article-post .paginator a:not(.page-number)').forEach(e => {
document.querySelectorAll('.home-container .paginator a:not(.page-number)').forEach(e => {
e.classList.add('btn');
e.setAttribute('role', 'navigation');
});