Git-Github-Hexo搭建博客

Posted zzw1024

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Git-Github-Hexo搭建博客相关的知识,希望对你有一定的参考价值。

之前添加:

<% if (theme.githubLink && theme.githubLink.enable) { %>
    <%- partial(‘_partial/github-link‘) %>
<% } %>

在_partial中添加github-link.ejs

<style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="<%- theme.githubLink.url %>" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="<%- theme.githubLink.title %>" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>

在config中添加

# Whether to display fork me on github icon and link, default true, You can change it to your repo address
# 配置是否在 header 中显示 fork me on github 的图标,默认为true,你可以修改为你的仓库地址.
githubLink:
  enable: true
  url: https://github.com/zzw1024
  title: Fork Me

添加音乐

在layout.ejs中添加

<!-- 音乐 -->
 <% if (theme.music.enable) { %>
    <%- partial(‘_widget/music‘) %>
<% } %>

在_widget中新建music.esj

<%
var audiosJson = JSON.stringify(site.data.musics);
%>

<link rel="stylesheet" href="<%- theme.libs.css.aplayer %>">
<div class="<% if (theme.music.enable && !theme.music.fixed) { %>music-player<% } %>">
    <% if (theme.music.showTitle) { %>
    <div class="title center-align">
        <i class="fas fa-music"></i>&nbsp;&nbsp;<%- theme.music.title %>
    </div>
    <% } %>
    <div class="row">
        <div class="col l8 offset-l2 m10 offset-m1 s12">
            <div id="aplayer" class="music"></div>
        </div>
    </div>
</div>

<script src="<%- theme.libs.js.aplayer %>"></script>
<script>
$(function () {
    new APlayer({
        container: document.getElementById(‘aplayer‘),
        fixed: ‘<%- theme.music.fixed %>‘ === ‘true‘,
        autoplay: ‘<%- theme.music.autoplay %>‘ === ‘true‘,
        theme: ‘<%- theme.music.theme %>‘,
        loop: ‘<%- theme.music.loop %>‘,
        order: ‘<%- theme.music.order %>‘,
        preload: ‘<%- theme.music.preload %>‘,
        volume: Number(‘<%- theme.music.volume %>‘),
        listFolded: ‘<%- theme.music.listFolded %>‘ === ‘true‘,
        listMaxHeight: ‘<%- theme.music.listMaxHeight %>‘,
        audio: eval(<%- audiosJson %>)
    });
});
</script>

在config中添加

# Whether to display the musics.
# 是否在首页显示音乐.
music:
  enable: false
  showTitle: true
  title: ‘亲,听听音乐放松放松。。。‘
  fixed: false # 开启吸底模式
  autoplay: false # 是否自动播放
  theme: ‘#42b983‘
  loop: ‘all‘ # 音频循环播放, 可选值: ‘all‘, ‘one‘, ‘none‘
  order: ‘list‘ # 音频循环顺序, 可选值: ‘list‘, ‘random‘
  preload: ‘auto‘ # 预加载,可选值: ‘none‘, ‘metadata‘, ‘auto‘
  volume: 0.7 # 默认音量,请注意播放器会记忆用户设置,用户手动设置音量后默认音量即失效
  listFolded: false # 列表默认折叠
  listMaxHeight: #列表最大高度

添加项目栏

添加分类标签等menu

其他的比如分类标签如下

添加page

hexo new page "menuName"

并且编辑对应的index

---
title: tags
date: 2018-12-12 21:25:30
type: "tags"   //一定得有
layout: "tags"  //一定得有
---

添加友链:

添加page

hexo new page "friends"

并且编辑对应的index

---
title: friends
date: 2018-12-12 21:25:30
type: "friends"
layout: "friends"  //一定的有
---

在hexo/source下新建 _data(下划线data) 目录,在 _data 目录中新建 friends.json 文件,文件内容如下所示:

[{
    "avatar": "http://image.luokangyuan.com/1_qq_27922023.jpg",
    "name": "码酱",
    "introduction": "我不是大佬,只是在追寻大佬的脚步",
    "url": "http://luokangyuan.com/",
    "title": "前去学习"
}, {
    "avatar": "http://image.luokangyuan.com/4027734.jpeg",
    "name": "闪烁之狐",
    "introduction": "编程界大佬,技术牛,人还特别好,不懂的都可以请教大佬",
    "url": "https://blinkfox.github.io/",
    "title": "前去学习"
}, {
    "avatar": "http://image.luokangyuan.com/avatar.jpg",
    "name": "ja_rome",
    "introduction": "平凡的脚步也可以走出伟大的行程",
    "url": "ttps://me.csdn.net/jlh912008548",
    "title": "前去学习"
}]

添加好文收藏

hexo new page "goodpapers"

修改站点_config.yml文件

menu:
  好文收藏:
    url: /goodpapers
    icon: fa-coffee

修该goodpapers/index.md

---
title: 好文收藏
date: 2019-02-18 11:09:48
---

1. [我的八年博士生涯](https://www.huxiu.com/article/273773.html?f=member_collections)         
2. [我曾是性用品微商](https://www.huxiu.com/article/285040.html?f=member_collections)
3. [乔布斯回归:从任性国王到铁腕企业家](https://www.huxiu.com/article/285320.html)
4. [那些简历造假拿 Offer 的程序员,后来都怎么样了?](https://mp.weixin.qq.com/s/a2rscuxJ0fl07OJ-0Shxfg)
5. [知网是个什么东西啊,好暴利](https://www.huxiu.com/article/285502.html)

添加相册

功能修改添加备忘录

添加简历(matery):
在about.ejs中加入一个新的card,直接复制上面的就行

修改简历:
在自己的about/index里面写表格建立

添加收藏文章:
在goodpapers/index里面写

添加友链:
在source/_data/friends.json里面按照格式写







以上是关于Git-Github-Hexo搭建博客的主要内容,如果未能解决你的问题,请参考以下文章

为 Blogger 上的博客格式化代码片段 [关闭]

Wordpress阻止访问wp admin€“wpsnipp.com网站你博客的Wordpress代码片段

spring练习,在Eclipse搭建的Spring开发环境中,使用set注入方式,实现对象的依赖关系,通过ClassPathXmlApplicationContext实体类获取Bean对象(代码片段

回归 | js实用代码片段的封装与总结(持续更新中...)

maven+spring boot搭建简单微服务

(转)博客园登陆__JSEncrypt 分析