首页 > 其他分享 >基于Jekyll的博客模板

基于Jekyll的博客模板

时间:2023-06-16 13:07:20浏览次数:34  
标签:category title com 博客 --- Jekyll post ruby 模板


概述



基于Jekyll的博客模板,清爽配色,简约风格。



详细



效果

基于Jekyll的博客模板_ruby

环境配置

环境

  • Windows 10
  • Git Bash

安装ruby

下载rubyinstaller安装:https://rubyinstaller.org/downloads/ (推荐Ruby 2.2.6版本)



$ ruby -v

安装DevKit

下载DevKit.exe:https://rubyinstaller.org/downloads/ ,解压完成后进入目录,init初始化,review检查,成功添加ruby目录后再install



$ ruby dk.rb init
$ ruby dk.rb review
$ ruby dk.rb install

安装Jekyll

切换gem镜像后再安装Jekyll(需要安装bundler)



$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
$ gem sources -l
https://gems.ruby-china.org
$ gem install Jekyll$ gem install bundler

新建博客



$ jekyll new ba-blog
$ jekyll server

模板套用

_config.yml

进行个性化全局配置。

# All possible configuration.
# For more see: http://jekyllrb.com/docs/configuration/
destination: ./_site
lsi: false
port: 4000
highligher: true
# Build settings
markdown: rdiscount
rdiscount:
 extensions: [smart]
# This is the default base url path.
BASE_PATH : /
# Website title.
title : Bee Ant<small>Wongjorie's Blog</small>
# label listing. [create labels for category in folder `_label`]
# social listing. [create labels for social in folder `_label`]
collections:
 - category
 - social
# This is the default format.
# For more see: http://jekyllrb.com/docs/permalinks/
permalink: /:title
# Pagination based on number of posts
# For more see: http://jekyllrb.com/docs/pagination/
#paginate: 20
#paginate_path: "page/:num"
 ## Author Details ##
###########################
author:
# Info
 name: Wong Jorie
 role: Computer Programmer
 email: 
 image: images/ba.jpg
# Social
 github: joriewong
 mail: 
# About
 about: ""
# copyright
 copyright: "Some rights reserved © 2018 Wong Jorie."
# Disable custom plugins,and ignore symbolic links..
# For more see: http://jekyllrb.com/docs/configuration/
safe: false
# Jekyll-sitemap auto generate
# For more see: https://github.com/jekyll/jekyll-sitemap
gems:
 - jekyll-sitemap

_category目录

1、侧边栏中的博客分类分别对应一个序号-同名.markdown文件,套用格式如下。

---
title: FE
short-description: 前端
permalink: FE
---

2、博客分类在项目根目录下有同名文件夹,其中包含index.md文件,套用格式如下。

---
layout: default
title: FE | 前端
---
<h1>前端</h1>
<hr/>
{% for category in site.categories %}
{% if category[0] == "FE" %}
 {% for posts in category %}
 {% for post in posts %}
{% if post.title %}
 {% if post.custom-link %}
<h2><a href="{{ post.custom-link }}"><small>{{ post.date | date: "%d %B, %Y" }}</small>{{ post.title }}</a></h2>
 {% else %}
<h2><a href="{{ post.url }}"><small>{{ post.date | date: "%d %B, %Y" }}</small>{{ post.title }}</a></h2>
 {% endif %}
<p>{{ post.excerpt | truncatewords:25 }}</p>
<hr/>
{% endif %}
 {% endfor %}
 {% endfor %}
{% endif %}
{% endfor %}

_layouts目录

整体布局模板和博文默认模板(无需修改)。

---
layout: default
---
<article>
<h1>{{page.title}}</h1>
<hr/>
{{content}}
</article>


_posts目录

每次撰写博文在此目录下新增.md文件即可,文件命名格式年-月-日-标题名.md,撰写时,文件头可配置博文分类,正文支持Markdown语法。

---
 layout: post
 title: Trim snippet
 categories: [Snippet]
---
正文部分

_social目录

侧边栏中的社交链接分别对应一个序号-同名.markdown文件,套用格式如下。

---
title: Mail
short-description: If you talk
permalink: "mailto:[email protected]"
---

首页、订阅配置

首页配置

首页图片为images下ba.jpg,可根据个人喜好随时更换,首页文字在项目根目录下index.html的<pre>标签中编辑。

---
layout: default
title: Bee Ant
---
<!-- 490 x 490 pixels -->
<img src="{{ BASE_PATH }}{{ site.author.image}}" alt="color photo ftl"/>
<!-- <p>Can't find your topic? Use <a href="{{ site.BASE_PATH }}search">Search Page</a></p> -->
<pre>
Life isn't always what one likes.
</pre>

订阅配置

项目根目录下feed.xml基本已完成RSS模板配置,只需变更一些个人信息即可。

<title>Bee Ant ~ Wongjorie's Blog</title>
...
<author>
 <name>Wong Jorie</name>
 <email></email>
 </author>

演示效果

侧边栏

基于Jekyll的博客模板_Jekyll_02

博文目录

基于Jekyll的博客模板_ruby_03

博文详情

基于Jekyll的博客模板_Jekyll_04

项目文件

基于Jekyll的博客模板_Jekyll_05


标签:category,title,com,博客,---,Jekyll,post,ruby,模板
From: https://blog.51cto.com/u_7583030/6499028

相关文章

  • 快速搭建一个自己的博客
    准备本地系统环境:Ubuntu20.04.5LTSNode版本:18.15Git版本:2.25.1一个github账号一台云服务器一个备案好的域名系统环境不同,根据自己的系统来操作就行,步骤差不多。Node、Git的版本选择长期稳定支持的新版本就行。云服务器和域名不是必须的,只是为了私有化更强。相信看到......
  • tr069 节点模板定义c语言
    #include<stdio.h>/*Signed*/typedefsignedcharint8_t;typedefshortintint16_t;typedefintint32_t;/*Unsigned.*/typedefunsignedcharuint8_t;typedefunsignedshortintuint16_t;typedefunsignedint......
  • 第三次博客:PTA题目集6-8总结
    第三次博客:PTA题目集6-8总结 前言:菜单系列终于结束了,但是接踵而至的是全新的选课系列,明明JAVA课都已经上完了,但是大作业的更新却并没有停止,由此可见蔡老师真的太爱我们了。这次的选课系统个人感觉是和点菜大同小异的,菜单==课表,选课==点菜,算......
  • 博客园 文字颜色/图片大小/图片居中
    图片居中设置:字体颜色:<fontsize=5>字体、字号和颜色</font><fontface="黑体">我是黑体字</font><fontface="微软雅黑">我是微软雅黑</font><fontface="STCAIYUN">我是华文彩云</font><fontcolor=#0099ffsize=7fac......
  • 博客园自定义样式修改标签页的icon图标
    步骤1:选择一张自己喜欢的图片,上传到https://www.logosc.cn/logo/favicon这个网站,将它转换成ico格式步骤2:进入博客园→文件界面,1.上传ico格式文件,2.点击这个文件步骤3:复制这一段url步骤4:进入博客园设置界面,将这段代码放入页眉<scripttype="text/javascript"language="jav......
  • 如何写技术博客
    新的一年,我们观远也开始尝试团队技术博客的形式,推出了观远技术团队博客这个新专栏。后续我们会在这个专栏收录观远各个技术团队的相关分享,专注于BI+AI数据智能领域的话题,包括前端,后端,算法,运维,测试等多个技术方向,欢迎感兴趣的小伙伴们订阅关注。对于文章中的问题,也非常欢迎大......
  • 小议C++函数签名与模板返回类型
    题记:什么事情都要追问一个为什么,真正理解了为什么,才能活学活用。代码1下面的代码能编译通过吗?#include<stdio.h>#include<stdlib.h>classX{public:int*get(){returnnewint();}double*get(){returnnewdouble();}};intmain(){int*v1=X()......
  • 【代码仓库】【模板】树链剖分
    #include<bits/stdc++.h>#definerep(i,a,b)for(inti=(a);i<=(b);i++)#definepre(i,a,b)for(inti=(a);i>=(b);i--)#defineEde(i,u)for(inti=h[u];i;i=ne[i])#definego(i,a)for(autoi:a)//#defineintlonglong#def......
  • 云小课|RDS for MySQL参数模板一键导入导出,参数配置轻松搞定
    摘要:云数据库RDSforMySQL支持参数模板的导入和导出功能。本文分享自华为云社区《【云小课】【第56课】RDSforMySQL参数模板一键导入导出,参数配置轻松搞定》,作者:数据库的小云妹。云数据库RDSforMySQL支持参数模板的导入和导出功能。导入参数模板:导入后会生成一个新的参数模板,......
  • 云小课|RDS for MySQL参数模板一键导入导出,参数配置轻松搞定
    摘要:云数据库RDSforMySQL支持参数模板的导入和导出功能。本文分享自华为云社区《【云小课】【第56课】RDSforMySQL参数模板一键导入导出,参数配置轻松搞定》,作者:数据库的小云妹。云数据库RDSforMySQL支持参数模板的导入和导出功能。导入参数模板:导入后会生成一个新的参......