feature(index): Build a homepage draft

This commit is contained in:
周中平 2021-12-28 17:05:11 +08:00
parent 68d3411d2e
commit 32abe6f33c
No known key found for this signature in database
GPG Key ID: B1DF9DD42D8E00DC
12 changed files with 719 additions and 97 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"compile-hero.disable-compile-files-on-did-save-code": false
}

View File

@ -1,50 +1,68 @@
<#include "module/macro.ftl">
<@layout title="${blog_title!}">
<h1>公告</h1>
<p>
${settings.index_notice!}
</p>
<main>
<div class="header">
<div class="title">
<a href="${blog_url!}"><span>无尽光芒</span></a>
</div>
<div class="description">
<p>${settings.sub_title!'the site subtitle'}</p>
<div class="socials">
<#if settings.github??>
<a href="${settings.github}" title="github" target="_blank"><i class="ri-github-line"></i></a>
</#if>
<#if settings.wechat??>
<a href="${settings.wechat}" title="wechat" target="_blank"><i class="ri-wechat-line"></i></a>
</#if>
<#if settings.bilibili??>
<a href="${settings.bilibili}" title="bilibili" target="_blank"><i class="ri-bilibili-line"></i></a>
</#if>
<#if settings.mail??>
<a href="mailto:${settings.mail}" title="mail" target="_blank"><i class="ri-mail-line"></i></a>
</#if>
<a href="/rss.xml" type="application/rss+xml" title="rss" target="_blank"><i class="ri-rss-line"></i></a>
</div>
</div>
</div>
<h1>文章列表</h1>
<ul>
<#list posts.content as post>
<li>
<a href="${post.fullPath!}">${post.title}</a>
</li>
<div class="post">
<h1><a href='${post.fullPath!}'>${post.title!}</a></h1>
<#if settings.enable_summary!true>
<p>${post.summary!}......</p>
</#if>
<div class="info">
<span class="date">
<i class="ri-map-pin-time-line"></i>
<span>${post.createTime?string('yyyy.MM.dd')}</span>
</span>
<#if post.tags?? && post.tags?size gt 0>
<span class="tag">
<i class="ri-bookmark-3-line"></i>
<#list post.tags as tag>
<a href="${tag.fullPath!}">${tag.name!}</a>
</#list>
</span>
</#if>
</div>
</div>
</#list>
</ul>
<h1>分页</h1>
<div class="pagenav">
<#if posts.totalPages gt 1>
<ul>
<@paginationTag method="index" page="${posts.number}" total="${posts.totalPages}" display="3">
<#if pagination.hasPrev>
<li>
<a href="${pagination.prevPageFullPath!}">
上一页
<a href="${pagination.prevPageFullPath!}" class="pre">
返回上页
</a>
</li>
</#if>
<#list pagination.rainbowPages as number>
<li>
<#if number.isCurrent>
<span class="current">第 ${number.page!} 页</span>
<#else>
<a href="${number.fullPath!}">第 ${number.page!} 页</a>
</#if>
</li>
</#list>
<#if pagination.hasNext>
<li>
<a href="${pagination.nextPageFullPath!}">
下一页
<a href="${pagination.nextPageFullPath!}" class="next">
更多文章
</a>
</li>
</#if>
</@paginationTag>
</ul>
<#else>
<span>当前只有一页</span>
</#if>
</div>
</main>
</@layout>

View File

@ -3,35 +3,31 @@
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>${title}</title>
<meta name="keywords" content="${meta_keywords!}"/>
<meta name="description" content="${meta_description!}" />
<#--
公共 head 代码详情请参考https://docs.halo.run/zh/developer-guide/theme/public-template-tag
包含Favicon自定义 head 等
-->
<@global.head />
<title>${title}</title>
<#--
样式 CSS 代码
-->
<link rel="stylesheet" href="${theme_base!}/source/css/normalize.css"/>
<link rel="stylesheet" href="${theme_base!}/source/css/animate.min.css"/>
<link rel="stylesheet" href="${theme_base!}/source/css/main.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css"/>
<link rel="stylesheet" href="${theme_base!}/source/css/color.css"/>
<link rel="stylesheet" href="${theme_base!}/source/css/redemption.css"/>
</head>
<body>
<#include "menu.ftl">
<body class="animate__animated animate__fadeInDown">
<#-- <#include "menu.ftl"> -->
<#-- 主体 -->
<#nested >
<#--
公共底部代码详情请参考https://docs.halo.run/zh/developer-guide/theme/public-template-tag
包含:统计代码,底部信息
-->
<footer>
<div class="copyright">
<a href="https://zeuk.me">Designed by Zeuk,</a>
<a href="https://halo.run">Proudly published with Halo</a>
</div>
<@global.footer />
</footer>
</body>
</html>
</#macro>

View File

@ -1,9 +1,53 @@
# 配置详情请参考https://docs.halo.run/zh/developer-guide/theme/config-files
genernal:
label: 基本设置
general:
label: 基础设置
items:
index_notice:
name: index_notice
label: 首页公告
sub_title:
name: sub_title
label: 二级标题
type: text
default: 'the site subtitle'
enable_mathJax:
name: enable_mathJax
label: 是否使用 MathJax
type: radio
data-type: bool
default: true
options:
- value: true
label: 开启
- value: false
label: 关闭
enable_summary:
name: enable_summary
label: 是否显示文章摘要
type: radio
data-type: bool
default: true
options:
- value: true
label: 开启
- value: false
label: 关闭
custom_css:
name: custom_css
label: 自定义样式
type: textarea
default: '欢迎来到我的博客'
sns:
label: 社交资料
items:
github:
name: github
label: Github
type: text
wechat:
name: wechat
label: wechat
type: text
bilibili:
name: bilibili
label: bilibili
type: text
mail:
name: mail
label: mail
type: text

161
source/css/Redemption.css Normal file
View File

@ -0,0 +1,161 @@
html {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 16px;
font-weight: 500;
font-variant-numeric: tabular-nums;
-webkit-font-smoothing: antialiased;
}
html::-webkit-scrollbar {
width: 10px;
height: 10px;
}
html::-webkit-scrollbar-thumb {
height: 40px;
border-radius: 16px;
}
body {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: center;
}
.header {
width: 45rem;
padding: 7rem 0 3rem 0;
-webkit-background-size: cover;
background-size: cover;
display: flex;
justify-content: space-between;
align-items: center;
}
.header .title {
width: 6rem;
}
.header .title a {
font-size: 2.2rem;
letter-spacing: 0.2rem;
line-height: 2.4rem;
}
.header .description {
font-size: 0.9rem;
}
.header .description .socials {
display: flex;
justify-content: flex-end;
}
.header .description .socials a {
font-size: 1rem;
margin-left: 0.5rem;
cursor: pointer;
}
main {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: center;
width: 50rem;
margin-top: 4rem;
}
main .post {
width: 45rem;
padding-top: 1rem;
}
main .post h1 a {
letter-spacing: 0.0625rem;
font-size: 1.375rem;
line-height: 1.75rem;
}
main .post p {
line-height: 1.5rem;
text-indent: 2rem;
}
main .post .info {
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
flex-direction: row;
padding: 0.5rem 0 2rem 0;
}
main .post .info span {
font-weight: 400;
font-size: 0.75rem;
}
main .post .info a {
font-size: 0.75rem;
}
main .post .info .date,
main .post .info .tag {
margin: 0 0.5rem;
}
main .post .info .date i,
main .post .info .tag i {
position: relative;
top: 0.05rem;
}
main .pagenav {
display: flex;
justify-content: space-between;
padding: 2rem 0 5rem 0;
}
main .pagenav a {
text-decoration: none;
margin: 0 2rem;
}
footer {
padding: 2rem 0;
}
footer .copyright {
font-size: 0.8rem;
}
footer .copyright a {
margin: 0 0.125rem;
}
/*animation starts*/
@-webkit-keyframes fadeInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-3px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
@-moz-keyframes fadeInDown {
0% {
opacity: 0;
-moz-transform: translateY(-3px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
@-o-keyframes fadeInDown {
0% {
opacity: 0;
-o-transform: translateY(-3px);
}
100% {
opacity: 1;
-o-transform: translateY(0);
}
}
@keyframes fadeInDown {
0% {
opacity: 0;
transform: translateY(-3px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/*animation ends*/

202
source/css/Redemption.scss Normal file
View File

@ -0,0 +1,202 @@
@charset "UTF-8";
// 全局 HTML 配置
html {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
font-size: 16px;
font-weight: 500;
font-variant-numeric: tabular-nums;
-webkit-font-smoothing: antialiased;
}
// 滚动条
html::-webkit-scrollbar {
width: 10px;
height: 10px;
}
html::-webkit-scrollbar-thumb {
height: 40px;
border-radius: 16px;
}
// Body 主体
body {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: center;
}
// Header 头部
.header {
width: 45rem;
padding: 7rem 0 3rem 0;
-webkit-background-size: cover;
background-size: cover;
display: flex;
justify-content: space-between;
align-items: center;
// 站点标题
.title {
width: 6rem;
a {
font-size: 2.2rem;
letter-spacing: 0.2rem;
line-height: 2.4rem;
}
}
// 二级标题
.description {
font-size: 0.9rem;
.socials {
display: flex;
justify-content: flex-end;
a {
font-size: 1rem;
margin-left: 0.5rem;
cursor: pointer;
}
}
}
}
// main 主体
main {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: center;
width: 50rem;
margin-top: 4rem;
.post {
width: 45rem;
padding-top: 1rem;
h1 {
a {
letter-spacing: 0.0625rem;
font-size: 1.375rem;
line-height: 1.75rem;
}
}
p {
line-height: 1.5rem;
text-indent: 2rem;
}
.info {
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
flex-direction: row;
padding: 0.5rem 0 2rem 0;
span {
font-weight: 400;
font-size: 0.75rem;
}
a {
font-size: 0.75rem;
}
.date,
.tag {
margin: 0 0.5rem;
i {
position: relative;
top: 0.05rem;
}
}
}
}
.pagenav {
display: flex;
justify-content: space-between;
padding: 2rem 0 5rem 0;
a {
text-decoration: none;
margin: 0 2rem;
}
}
}
footer {
padding: 2rem 0;
.copyright {
font-size: 0.8rem;
a {
margin: 0 0.125rem;
}
}
}
/*animation starts*/
@-webkit-keyframes fadeInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-3px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
@-moz-keyframes fadeInDown {
0% {
opacity: 0;
-moz-transform: translateY(-3px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
@-o-keyframes fadeInDown {
0% {
opacity: 0;
-o-transform: translateY(-3px);
}
100% {
opacity: 1;
-o-transform: translateY(0);
}
}
@keyframes fadeInDown {
0% {
opacity: 0;
transform: translateY(-3px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
/*animation ends*/

File diff suppressed because one or more lines are too long

79
source/css/color.css Normal file
View File

@ -0,0 +1,79 @@
html {
background-color: #f5f5f5;
color: #1f1f1f;
}
html::-webkit-scrollbar-thumb {
background-color: #0000000d;
}
html::-webkit-scrollbar-thumb:hover {
background-color: #00000026;
}
::selection {
background: #0095ff1a;
}
body {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: center;
}
.header .title a span {
color: black;
}
.header .title a span:hover {
color: rgba(0, 0, 0, 0.65);
}
.header .description {
color: rgba(0, 0, 0, 0.65);
}
.header .description .socials a {
color: rgba(0, 0, 0, 0.65);
}
.header .description .socials a:hover {
color: rgba(0, 0, 0, 0.85);
}
main {
background: #ffffff;
box-shadow: 0 0.375rem 1rem -0.5rem rgba(0, 0, 0, 0.08);
}
main .post h1 a {
color: black;
}
main .post p {
color: rgba(0, 0, 0, 0.85);
}
main .post .info {
border-bottom: 1px solid #f3f3f3;
}
main .post .info span {
color: rgba(0, 0, 0, 0.65);
}
main .post .info a {
color: rgba(0, 0, 0, 0.65);
}
main .post .info .date i,
main .post .info .tag i {
color: rgba(0, 0, 0, 0.85);
}
main .pagenav {
border-bottom: 1px solid #f2f2f2;
}
main .pagenav a {
color: black;
}
main .pagenav a:hover {
color: rgba(0, 0, 0, 0.65);
}
footer .copyright a {
color: rgba(0, 0, 0, 0.25);
}
footer .copyright a:hover {
color: rgba(0, 0, 0, 0.85);
}

125
source/css/color.scss Normal file
View File

@ -0,0 +1,125 @@
// HTML
html {
background-color: #f5f5f5;
color: #1f1f1f;
}
// 滚动条
html::-webkit-scrollbar-thumb {
background-color: #0000000d;
}
html::-webkit-scrollbar-thumb:hover {
background-color: #00000026;
}
::selection {
background: #0095ff1a;
}
// Body
body {
display: flex;
flex-wrap: nowrap;
flex-direction: column;
align-items: center;
}
// Header 头部
.header {
// 站点标题
.title {
a {
span {
color: rgb(0, 0, 0);
&:hover {
color: rgba(0, 0, 0, 0.65);
}
}
}
}
// 二级标题
.description {
color: rgba(0, 0, 0, 0.65);
.socials {
a {
color: rgba(0, 0, 0, 0.65);
&:hover {
color: rgba(0, 0, 0, 0.85);
}
}
}
}
}
// main 主体
main {
background: #ffffff;
box-shadow: 0 0.375rem 1rem -0.5rem rgba(0, 0, 0, 0.08);
.post {
h1 {
a {
color: rgba(0, 0, 0, 1);
}
}
p {
color: rgba(0, 0, 0, 0.85);
}
.info {
border-bottom: 1px solid #f3f3f3;
span {
color: rgb(0, 0, 0, 0.65);
}
a {
color: rgb(0, 0, 0, 0.65);
}
.date,
.tag {
i {
color: rgb(0, 0, 0, 0.85);
}
}
}
}
.pagenav {
border-bottom: 1px solid #f2f2f2;
a {
color: rgb(0, 0, 0);
&:hover {
color: rgb(0, 0, 0, 0.65);
}
}
}
}
// 脚注
footer {
.copyright {
a {
color: rgb(0, 0, 0, 0.25);
&:hover {
color: rgb(0, 0, 0, 0.85);
}
}
}
}

View File

@ -1,3 +0,0 @@
html {
width: 100%;
}

View File

@ -1,3 +0,0 @@
html{
width: 100%;
}

View File

@ -347,3 +347,10 @@
[hidden] {
display: none;
}
/*
* 去除链接下划线
*/
a {
text-decoration: none;
}