Back
Featured image of post Blog更改日志

Blog更改日志

记载了这个blog的前世今生

TODO

  • HugoTex theme 更换到 stack theme

  • 更改 点击home会在新页面弹出 ——> 本页刷新

  • 更改文章的归档类别,精简 categories

  • Google 百度等收录网页

  • 更换挂载服务商

    垃圾gitee( gitee page 显示index.json可能含有违规内容,删去,导致blog的搜索功能失效 )

  • 添加字数统计

    • 单文章字数统计
    • footer 总字数和文章数统计
  • 添加音乐

  • 添加更多Markdown支持

    shortcode

    文字居中

    • 支持表情
    • 支持github格式的 !!! note 和 !!! danger
    • github 风格的 chackbox ,明显的蓝色 √
    • 将KaTex支持升级
    • 支持使用 Font awesome
  • 页面美化

    • 折叠式侧边栏

    • 字体

      • 更换字体
      • 调整字体大小
    • 颜色

      • 页面配色
        • 底色
        • 滑块颜色
      • link 颜色
      • 赛博朋克块阴影 (不要了)
    • 头像与名称居中显示

    • 调整页面比例,比较喜欢缩放到80%~90%

    • 增加网站icon

    • 使用物色到的icon

      • 字数统计、显示时间的icon
    • 修改 card 圆角 10 $\Rightarrow$ 7

    • 圆角 tag --tag-border-radius: 4px; $\Rightarrow$ 20

  • 社交

    • 编写自己的 about
    • 添加评论功能
    • 完善其他跳转信息,如脸书可是我没有、知乎等账号链接
    • 添加友链

记录

HugoTex theme 更换到 stack theme

添加字数统计

单文章字数统计 : 借鉴小球飞鱼,改layouts\partials\article\components\details.html

        {{ if .Site.Params.article.readingTime }} 
            <div>
                {{ partial "helper/icon" "文本" }} 
                <time class="article-words">
                    {{ .WordCount }}字
                </time>
            </div>

并在config.yaml设置hasCJKLanguage: true

总字数和文章数统计 : Hugo 总文章数和总字数

页面美化

排版

修改 assets\scss\partials\article.scss 文件,添加瀑布流效果

/* Default article style */
.article-list {
    // display: flex;
    flex-direction: column;
    column-fill: balance;
    
    @media screen and (min-width: 1600px){
        column-count: auto;
        column-gap: var(--section-separation);
        column-width: 350px;
        max-width: 1500px;
        margin: auto;
        }

    article {
        // 
            
        display: inline-block;   //
        width: 100%;             
        break-inside: avoid;     

        // display: flex;
        flex-direction: column;
        box-sizing:border-box;
        position: relative;

        background-color: var(--card-background);
        box-shadow: var(--shadow-l1);
        border-radius: var(--card-border-radius);
        overflow: hidden;

        transition: box-shadow 0.7s ease;
        transition: 0.5s;

        @media screen and (min-width: 1600px){
            // width: 32%;
            width: 100%;
            header .article-image{
                img{
                    position: relative;
                    right:auto;
                    width:100%;
                    height:40%;
                    max-height: 250px;
                }
            }
            header .article-home-details{
                width: 100%;
            }
            header .article-details .article-home-title{
                @include respond(xl) {
                    font-size: 2rem;
                }
            }
        }

        &:hover {
            box-shadow: var(--shadow-l2);
            border-radius: 45px;
            @include respond(md) {
                --main-top-padding: 25px;
                --article-font-size: 2.1rem;
            }
        }
            
        &:not(:last-of-type) {
            margin-bottom: var(--section-separation);
            
        }

        .article-image {
            img {
                position: absolute;
                right:0;
                display:flex;
                width:40%;
                height:100%;
                object-fit: cover; 
                object-position: 50% 50%;
                overflow: auto;

                @include respond(xl) {
                    height: 100%;
                }
            }
        }

        @for $i from 1 through length($defaultTagBackgrounds) {
            &:nth-child(#{length($defaultTagBackgrounds)}n + #{$i}) {
                .article-category a {
                    background: nth($defaultTagBackgrounds, $i);
                    color: nth($defaultTagColors, $i);
                }
            }
        }
    }
}

.article-details {
    display: flex;
    flex-direction: column;
    justify-content: center;

    padding: var(--card-padding);
}

.article-title {
    font-weight: 600;
    margin: 10px 0;
    color: var(--card-text-color-main);
    font-size: 2.2rem;

    @include respond(xl) {
        font-size: 3rem;
    }

    a {
        color: var(--card-text-color-main);

        &:hover {
            color: var(--card-text-color-main);
        }
    }

    & + .article-subtitle {
        margin-top: 1;
    }
}

.article-subtitle {
    font-weight: normal;
    color: var(--card-text-color-secondary);
    margin: 5px 0;
    line-height: 1.5;

    font-size: 1.75rem;
    @include respond(xl) {
        font-size: 2rem;
    }
}

.article-time {
    display: flex;
    align-items: center;
    color: var(--card-text-color-tertiary);
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;

    svg {
        vertical-align: middle;
        margin-right: 15px;
        width: 20px;
        height: 20px;
        stroke-width: 1.33;
    }

    time {
        font-size: 1.4rem;
    }

    & > div {
        display: inline-flex;
        align-items: center;
    }
}

.article-category,
.article-tags {
    a {
        color: var(--accent-color-text);
        background-color: var(--accent-color);
        padding: 6px 14px;
        border-radius: 16px;
        display: inline-block;
        font-size: 1.3rem;
        margin-right: 7px;
        margin-bottom: 7px;
        transition: background-color 0.5s ease;

        opacity:1;
        transition:0.3s;

        &:hover {
            color: var(--accent-color-text);
            background-color: var(--accent-color-darker);
        }
        @media screen and (min-width: 1600px){
            border-radius: 3px;
            padding: 4px 10px;
        }
    }
}
/*
.article-details:hover .article-category a {
    opacity:0;
    height:0px;
}
*/
/* Compact style article list */
.article-list--compact {
    border-radius: var(--card-border-radius);
    box-shadow: var(--shadow-l1);
    background-color: var(--card-background);
    --image-size: 50px;

    @include respond(md) {
        --image-size: 60px;
    }

    & + .pagination {
        margin-top: var(--section-separation);
    }

    article {
        & > a {
            display: flex;
            align-items: center;
            padding: var(--small-card-padding);
        }

        &:not(:last-of-type) {
            border-bottom: 1.5px solid var(--card-separator-color);
        }

        .article-details {
            flex-grow: 1;
            padding: 0;
            padding-right: 15px;
            min-height: var(--image-size);
        }

        .article-title {
            margin: 0;
            font-size: 1.6rem;

            @include respond(md) {
                font-size: 1.8rem;
            }
        }

        .article-image {
            height: 100%;
            img {
                width: var(--image-size);
                height: var(--image-size);
                object-fit: cover;
            }
        }

        .article-time {
            font-size: 1.4rem;
        }

        .article-preview {
            font-size: 1.4rem;
            color: var(--card-text-color-tertiary);
            margin-top: 10px;
            line-height: 1.5;
        }
    }
}

/* Tile style article list */
.article-list--tile {
    display: flex;
    height: auto;
    width: 100%;
    article {
        border-radius: var(--card-border-radius);
        overflow: hidden;
        position: relative;
        height: 350px;
        width: 250px;
        box-shadow: var(--shadow-l1);
        transition: box-shadow 0.3s ease;
        background-color: var(--card-background);

        &:hover {
            box-shadow: var(--shadow-l2);
        }

        &.has-image {
            .article-details {
                background-color: rgba(#000, 0.25);
            }

            .article-title {
                color: #fff;
            }
        }

        .article-image {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;

            img {
                width: 100%;
                height: 100%;
                object-fit: cover;
            }
        }

        .article-details {
            border-radius: var(--card-border-radius);
            position: relative;
            height: 100%;
            width: 100%;
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            z-index: 2;
            padding: 15px;

            @include respond(sm) {
                padding: 20px;
            }
        }

        .article-title {
            font-size: 2rem;
            font-weight: 500;
            color: var(--card-text-color-main);

            @include respond(sm) {
                font-size: 2.2rem;
            }
        }
    }
}



///
/// article  主页显示
.article-home-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width:60%;

    padding: var(--card-padding);
}

.article-home-title {
    font-weight: 600;
    margin: 10px 0;
    color: var(--card-text-color-main);
    font-size: 2.2rem;
    transition: 0.5s;

    overflow: hidden;
    width: fit-content;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: break-all;

    @include respond(xl) {
        font-size: 2.7rem;
    }

    a {
        color: var(--card-text-color-main);

        &:hover {
            color: var(--card-text-color-main);
        }
    }

    & + .article-home-subtitle {
        margin-top: 1;
    }
}

.article-home-details:hover .article-home-title {
    font-size: 2.4rem;
}

.article-home-subtitle {
    font-weight: normal;
    color: var(--card-text-color-secondary);
    margin: 5px 0;
    line-height: 1.5;
    opacity:0;
    height: 0px;
    transition:0.5s;

    overflow:hidden;

    font-size: 1.75rem;
    @include respond(xl) {
        font-size: 2rem;
    }
}

.article-home-details:hover .article-home-subtitle {
    opacity:1;
    height: 5.4rem;
}

字体

更换字体

看对应部分,简单的复制粘贴 (不过之后想换成方正新书宋或者冬青黑,英文标题部分用贝连体)

调整字体大小

位置 assets\scss\variables.scss

--article-font-size: 1.7rem; $\Rightarrow$ 1.9

颜色

页面配色

底色 :

  • light ☞ 改了一圈 仅将背景色弄浅了一点
  • dark ☞ --body-background: #1e202b; 颜色是从中国传统色漆黑调浅

滑块颜色:

  • light --scrollbar-thumb: hsla(170, 94%, 55%, 0.575);
  • dark --scrollbar-thumb: #c91f37; 赫赤色

从灰色改为 --link-background-color: 1, 255, 179;

赛博朋克块阴影

--shadow-l1: 1.4px -1.4px 0px rgba(67, 255, 230, 0.719), 0px 3px 10px rgba(0, 0, 0, 0.04), 0px 1.4px 1px rgba(253, 25, 113, 0.397);

更多markdown支持

在文档末添加如下,就可以使用 Font awesome 5 的非Pro icon , 使用方式也很便捷,直接在Font awesome 里面找,点复制粘贴过来就可以了。

<head> 
    <script defer src="https://use.fontawesome.com/releases/v5.11.0/js/all.js"></script> 
    <script defer src="https://use.fontawesome.com/releases/v5.11.0/js/v4-shims.js"></script> 
</head> 
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.0/css/all.css">

不花钱 没必要使用Font awesome 6 ,不如去阿里弄得iconfont 去淘 icon,下面是后来的配置,两方面都能使用。

<head>
    <script src="https://kit.fontawesome.com/cbd1a514ae.js" crossorigin="anonymous"></script> #Font awesome 的kit,注册后创建一个
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_3178786_wcuwkyqh11.css"> #iconfont 账号的项目,注册后创建一个
</head>

但是有一些问题,比如

    1. 不能很好的显示彩色icon (包括font awesome),后面的两个icon是下面彩色icon现在的显示情况。
    1. 每次往iconfont项目库里添加新icon,都要更新项目库,把项目库新地址复制过来,有点麻烦。

# 在head里添加
<script src="https://at.alicdn.com/t/font_3178786_idyehkf29xd.js"></script>

----------------

# 上面两个彩svg的引用代码
<div>
  <svg class="icon" aria-hidden="true">
      <use xlink:href="#icon-xinxi"></use>
  </svg>
  <svg class="icon" aria-hidden="true">
      <use xlink:href="#icon-10"></use>
  </svg>
</div>

----------------

<style type="text/css">
    .icon {
       width: 1em; height: 1em; # 可以通过这种方式控制icon大小
       vertical-align: -0.15em;
       fill: currentColor;
       overflow: hidden;
    }
</style>

如果是做前端,还稍微可以接受。对于写markdown笔记,这么做实在是太麻烦了点(强迫症震怒),看到有使用 vue 封装简化操作的(有一点探索过头了,活该是有追求的前端干的事)。 但无论怎么说,在markdown里用这么多HTML语句和初衷有些本末倒置。

Shortcode

⭕ 能用 | ❌ 一番尝试后失败

一开始想将Feelit上的shortcode抄过来,具体是admonitionmusic typeit,把\layouts\shortcodes\复制进来没法正常用,自定义 Hugo Shortcodes 简码写的很详细,搬过来alignquote⭕,

水水水

This is a tip
一个 技巧 横幅

Typeit

评论功能

吆西,直接参照waline文档,先注册个 LeanCloud , 注意是国际版,然后再GitHub登录下Vercel ,是从 快速上手–Vercel 部署 点击过去(球球网你让我登录!)

waline文档 快速上手中 除了 HTML引入(客户端) 以外的照着做就好,之后在config.yaml 里改前端配置

    comments:
        enabled: true
        provider: waline

        waline:
            serverURL: //你通过vercel获得的waline服务器地址
            lang: 'zh-CN'
            visitor: true
            avatar: 
            emoji:
                - https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo
                - https://cdn.jsdelivr.net/gh/norevi/waline-blobcatemojis@1.0/blobs
                - https://cdn.jsdelivr.net/gh/norevi/blob-emoji-for-waline@2.0/blobs-gif

            requiredMeta:
                - name
                - email
                - url
            placeholder:
            locale:
                admin: Admin

更多的(表情包、修改黑暗模式和表情包大小)移步到参考链接,基本上是复制粘贴

参考

小球飞鱼 | Hugo | 看中 Stack 主题的归档功能,搬家并做修改

CSS(层叠样式表)

中国传统颜色手册

小球飞鱼 | Hugo | 为 Blog 增加评论区

waline文档

No.revi | Hugo|引入外部字体

No.revi | Waline|添加自定义表情

在 Hugo 主题 Stack 中轻松配置 Waline 评论系统

花裤衩coder | 手摸手,带你优雅的使用 icon

Hugo嵌入音乐播放器

APlayer & MetingJS 音乐播放器使用指南

探究几种CSS视差动画实现方案及原理

Zdog - Celeste snowglobe 的样例

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme designed by DeathSprout