Blog

Melody主题个性化修改memo

1. 修改为Google Analytics V4

Google Analytics已更新到4.0版本,页面引用方式有变化,在Melody主题的dev分支下作者已经更新了代码,master分支需要手动修改。

文件位置\hexo-theme-melody\layout\includes\head.pug

修改代码

if theme.google_analytics
  script(src="https://www.googletagmanager.com/gtag/js?id="+theme.google_analytics)
  script.
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', '!{theme.google_analytics}');

2.修改行内引用代码块颜色

主题配置文件的颜色选项不能修改行内代码块的颜色,原颜色太淡。

文件位置\hexo-theme-melody\source\css\var.styl

修改代码

$code-background = rgba(101,196,235,0.2)

本文所做修改已打包至hexo-theme-melody-lufer,可通过npm install hexo-theme-melody-lufer来进行安装。

使用此包注意要修改_config.yml中的themetheme: melody-lufer
把主题配置文件名由_config.melody.yml改为_config.melody-lufer.yml