装修博客中

东抄抄西抄抄

极乐迪斯科风格着色

其实就是html标签,插入md过程稍显复杂,先凑合用着。极乐迪24个技能汇总

效果:

故弄玄虚 [极难:失败] - 不幸的是,您的成就当中似乎没什么值得一提的。您应该求助于谎言了。

内陆帝国 [简单:成功] - 是时候面对源头了。不要害怕,因为宇宙的力量会支持你完成这次的超自然任务。

五感发达(视觉) [中等:成功] - 一群附近的海鸥被轰鸣的电台吓了一跳,惊慌飞起。

天人感应 - 抬头望向天空,冰冷的雨水从你的头发上滴落。

custom.scss添加:(为了同时适配light/dark mode对原作颜色进行了一些更改)

.disco-purple {
    color: #8266d1;
    font-weight: bold;
}

.disco-pink {
color: #c75372;
font-weight: bold;
}

.disco-grey {
    color: #a0a0a0
}

.disco-blue {
    color: #4ea7b7;
    font-weight: bold;
  }
  
.disco-yellow {
color: #c39f2d;
font-weight: bold;
}

使用:

<span class="disco-blue">故弄玄虚</span> <span class="disco-grey">[极难:失败]</span> - 不幸的是,您的成就当中似乎没什么值得一提的。您应该求助于谎言了。

<span class="disco-purple">内陆帝国</span> <span class="disco-grey">[简单:成功]</span> - 是时候面对源头了。不要害怕,因为宇宙的力量会支持你完成这次的超自然任务。

<span class="disco-yellow">五感发达(视觉)</span> <span class="disco-grey">[中等:成功]</span> - 一群附近的海鸥被轰鸣的电台吓了一跳,惊慌飞起。

<span class="disco-pink">天人感应</span> - 抬头望向天空,冰冷的雨水从你的头发上滴落。

添加回到顶部

参考

首先准备一个图标,放在assets/icons/backTop.svg。我准备的叫arrow-up-dashed,可以直接复制如下代码也可以去下载别的stack主题图标

<svg xmlns="http://www.w3.org/2000/svg"
     width="100%" height="100%"
     viewBox="0 0 24 24"
     fill="none"
     stroke="currentColor"
     stroke-width="2"
     stroke-linecap="round"
     stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
  <path d="M12 5v6m0 3v1.5m0 3v.5" />
  <path d="M18 11l-6 -6" />
  <path d="M6 11l6 -6" />
</svg>

layouts/partials/footer/custom.html中,添加

<!--返回顶部 CSS -->
<style>
  #back-to-top {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* ensure no internal spacing */
    position: fixed;
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--body-background);
    box-shadow: var(--shadow-l2);
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
  }

  #back-to-top svg {
    width: 70%;
    height: 70%;
    display: block;
    margin-top: 7px; /*折腾半天无法居中 代码比较丑陋*/
    margin-left: 7px;
    fill: var(--accent-color);
  }

  #back-to-top:hover svg {
    fill: var(--accent-color-darker);
  }


  @media screen and (max-width: 768px) {
    #back-to-top {
      width: 50px;
      height: 50px;
      background-size: 70%;
    }
  }


  @media screen and (min-width: 1024px) {
    #back-to-top {
      bottom: 10px;
      right: 20px;
    }
  }

  @media screen and (min-width: 1280px) {
    #back-to-top {
      bottom: 15px;
      right: 25px;
    }
  }

  @media screen and (min-width: 1536px) {
    #back-to-top {
      bottom: 15px;
      right: 25px;
    }
  }
</style>

layouts/partials/footer/components/script.html添加

<!-- Add back to top button -->
 <script>
     function backToTop() {
       document.documentElement.scrollIntoView({
         behavior: 'smooth',
       })
     }
   
     window.onload = function () {
       let scrollTop =
         this.document.documentElement.scrollTop || this.document.body.scrollTop
       let totopBtn = this.document.getElementById('back-to-top')
       if (scrollTop > 0) {
         totopBtn.style.display = 'inline'
       } else {
         totopBtn.style.display = 'none'
       }
     }
   
     window.onscroll = function () {
       let scrollTop =
         this.document.documentElement.scrollTop || this.document.body.scrollTop
       let totopBtn = this.document.getElementById('back-to-top')
       if (scrollTop < 200) {
         totopBtn.style.display = 'none'
       } else {
         totopBtn.style.display = 'inline'
         totopBtn.addEventListener('click', backToTop, false)
       }
     }
   </script>

Safari浏览器书签收录网站icon

  1. static/文件夹,添加一个exactly named apple-touch-icon.png 的文件

  2. layouts/partials/head/custom.html,添加

<link rel="apple-touch-icon" href="/apple-touch-icon.png">
  1. 清除Safari中关于网站的cache

  2. 添加书签到启动页

聊天气泡

参考:Yelle - hugo stack 主题美化

效果:

John Doe   2025-04-12 14:30
这是左边的消息内容。
2025-04-12 14:45   Alice
这是右边的消息内容,测试长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长长度。

新建layouts/shortcodes/chat.html

  {{ if eq (.Get "position") "left" }}
<div class="chat --other">
    <div class="chat__inner">
        <div class="chat__meta">{{ .Get "name" }}&nbsp;&nbsp;&nbsp;{{ .Get "timestamp" }}</div>
        <div class="chat__text">
            {{ .Inner }}
        </div>
    </div>
</div>
{{ else if eq (.Get "position") "right" }}
<div class="chat --self">
    <div class="chat__inner">
        <div class="chat__meta" style="text-align: right;">{{ .Get "timestamp" }}&nbsp;&nbsp;&nbsp;{{ .Get "name" }}</div>
        <div class="chat__text">
            {{ .Inner }}
        </div>
    </div>
</div>
{{ end }}

<style>
    .chat {
        margin: 10px;
        padding: 10px;
        position: relative;
        /* 添加相对定位,以便定位尖角箭头 */
        transition: transform 0.2s;
        /* 添加过渡效果,使放大平滑 */
        max-width: 80%;
        min-width: 15%;
    }
    
    .chat:hover {
        transform: scale(1.05);
    }
    
    .chat.--self {
        text-align: left;
        background-color: #ecf5ff;
        color: #000000;
        border-radius: 15px;
        width: fit-content;
        margin-left: auto;
    }
    /* 尖角箭头 */
    
    .chat.--self::before {
        content: "";
        position: absolute;
        right: -18px;
        /* 调整箭头位置 */
        bottom: 5px;
        transform: translateY(-50%);
        border-width: 15px 0 0 20px;
        border-style: solid;
        border-color: transparent transparent transparent #ecf5ff;
        /* 箭头颜色与对话框背景颜色一致 */
    }
    /* 左边对话框样式 */
    
    .chat.--other {
        text-align: left;
        background-color: #ffecec;
        color: #333;
        border-radius: 15px;
        position: relative;
        width: fit-content;
    }
    /* 左边对话框的尖角箭头 */
    
    .chat.--other::before {
        content: "";
        position: absolute;
        left: -18px;
        bottom: 5px;
        transform: translateY(-50%);
        border-width: 15px 20px 0 0;
        border-style: solid;
        border-color: transparent #ffecec transparent transparent;
    }
    /* 消息元数据样式(名称和时间戳) */
    
    .chat__meta {
        font-weight: bold;
        font-size: 0.67em;
        color: #707070;
        margin-bottom: 5px;
    }
    /* 消息文本样式 */
    
    .chat__text {
        font-size: 0.9em;
        margin-left: 10px;
        word-break: break-all;
    }
    
    [data-scheme="dark"] {
        .chat.--self {
            color: #fefefe;
            background-color: #253958;
        }
        .chat.--self::before {
            border-color: transparent transparent transparent #253958;
        }
        .chat.--other {
            color: #fefefe;
            background-color: #1a1a1a;
        }
        .chat.--other::before {
            border-color: transparent #1a1a1a transparent transparent;
        }
        .chat__meta {
            color: #b1b1b1;
        }
    }
</style>

固定代码块高度

参考:Hugo Stack 魔改美化

remove苹果相册自带的EXIF方向信息

从MacBook的相册拖拽到vscode的时候发现渲染之后图片方向会变。询问gpt以后发现是mac自带了方向信息来保证显示正确,但hugo并不识别这个信息。遂使用命令行把方向校正一下。在mac的相册里转一下再转回来也可以。

cd content/page/gallery
mogrify -auto-orient *.jpeg

notice

参考 Naive Koala_一些Hugo短代码

使用例

{\{< notice notice-warning >}}
你好。
{\{< /notice >}}

{\{< notice notice-info >}}
你好。
{\{< /notice >}}

{\{< notice notice-note >}}
你好。
{\{< /notice >}}

{\{< notice notice-tip >}}
你好。
{\{< /notice >}}

你好。

你好。

你好。

你好。

neodb

参考

使用

{\{< neodb "NeoDB 网址/豆瓣网址" >}\}

示例

9.5
《极乐迪斯科》是在一款奇幻都市设定下,极具开创性的硬汉风侦探类等距视角角色扮演游戏。 你将扮演一位落魄潦倒的中尉侦探,身处堕落的港口城市雷瓦科城,这里腐败横行,谋杀案一波未平一波又起,青少年们也整天只想着蹦迪。你在其中或是搜寻线索,审讯疑犯,或是探索这座广袤迷人的手绘城市,揭露它深埋的秘密。与此同时,局势逐渐恶化,城中冲突加剧,危机一触即发…… 极乐迪斯科原创的全套技能系统使你可以与游戏产生高维度的对话,谈论你内心深处的感受、疑惑、甚至记忆,逐渐养成专属于你的人设。强化理性思维系统?磨练社交能力?抑或是屈服于本能?只有你能决定成为怎样的警探。
game

归档页面双栏

参考

/assets/scss/custom.scss 中加入以下代码

// 归档页面两栏
@media (min-width: 1024px) {
  .article-list--compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: none;
    box-shadow: none;
    gap: 1rem;

    article {
      background: var(--card-background);
      border: none;
      box-shadow: var(--shadow-l2);
      margin-bottom: 8px;
      border-radius: 16px;
    }
  }
}

美化滚动条

参考

custom.scss中添加

//美化滚动条
html{
    ::-webkit-scrollbar {
        width: 20px;
      }
      
      ::-webkit-scrollbar-track {
        background-color: transparent;
      }
      
      ::-webkit-scrollbar-thumb {
        background-color: #d6dee1;
        border-radius: 20px;
        border: 6px solid transparent;
        background-clip: content-box;
      }
      
      ::-webkit-scrollbar-thumb:hover {
        background-color: #a8bbbf;
      }
}

相关文章添加日期

参考

layouts/partials/article-list/tile.html中修改line 33 article details:

        <div class="article-details">
            <h2 class="article-title">
                {{- .context.Title -}}
            </h2>
            <!-- 自行增加的文章发布日期 -->
            <h2 class="article-time">
                <time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
                    {{- .context.Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
                </time>
            </h2>
        </div>
Reproduction in any form is strictly prohibited without permission.
发表了39篇文章 · 总计68.28k字
本博客已稳定运行
使用 Hugo 构建
主题 StackJimmy 设计