我的jekyll配置和修改
配置 修改 Jekyll
2023-09-14 08:56:52 时间
主要记录使用jekyll搭建博客时的一些配置和修改。
注意: 使用时请删除{和%以及{和{之间的空格。
source ~/.bash_profile jekyll server添加about me 边栏
参考the5fire的技术博客在index.html页面加入如下代码:
section h4 About me /h4 div 一个Java方案架构师,主要从事hadoop相关工作。 a href="/about.html" 更多信息 /a br/ br/ strong font color="red" a href="/atom.xml" target="_blank" 订阅本站 /a /font /strong br/ br/ 联系博主:javachen.june[a]gmail.com /div /section添加about页面
在根目录创建about.md并修改,注意:文件开头几行内容如下
title: About layout: page group: navigation设置固定链接
在 _config.yml 里,找到 permalink,设置如下:
permalink: /:categories/:year/:month/:day/:title修改,markdown实现为redcarpet
首先通过gem安装redcarpet,然后修改_config.yml:
redcarpet: extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "tables", "strikethrough", "superscript", "with_toc_data", "highlight", "prettify"]首页添加最近文章
在index.html页面
section h4 Recent Posts /h4 ul id="recent_posts" { % for rpost in site.posts limit: 15 %} a href="" /a /li { % endfor %} /ul /section首页为每篇文章添加分类、标签、发表日期以及评论连接
在index.html页面找到 h3 a href="{ { BASE_PATH }}{ { post.url }}" { { post.title }} /a /h3 ,在下面添加:
div Categories: { %for cg in post.categories % } a href="/categories.html#-ref" /a { %if forloop.index forloop.length % } { %endif%} { %endfor%} Tags: { %for cg in post.tags %} a href="/tags.html#-ref" /a { %if forloop.index forloop.length %} { %endif%} { %endfor%} Time: time date="{ { post.date|date: %Y-%m-%d }}" /time a href=#comments title=分享文章、查看评论 Comments /a /div修改h1、h2等标题字体
主要是参考图灵社区的css,在assets/themes/twitter/css/style.css中添加如下css代码:
h1,h2,h3,h4,h5,h6{margin:18px 0 9px;font-family:inherit;font-weight:normal;color:inherit;text-rendering:optimizelegibility;}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;color:#999999;} h1{font-size:30px;line-height:36px;}h1 small{font-size:18px;} h2{font-size:24px;line-height:36px;}h2 small{font-size:18px;} h3{font-size:18px;line-height:27px;}h3 small{font-size:14px;} h4,h5,h6{line-height:18px;} h4{font-size:14px;}h4 small{font-size:12px;} h5{font-size:12px;} h6{font-size:11px;color:#999999;text-transform:uppercase;}添加返回顶部功能
同样是参考了图灵社区的css和网上的一篇js实现。在assets/themes/twitter/css/style.css:
.backToTop { display: block; width: 40px; height: 32px; font-size: 26px; line-height: 32px; font-family: verdana, arial; padding: 5px 0; background-color: #000; color: #fff; text-align: center; position: fixed; _position: absolute; right: 10px; bottom: 100px; _bottom: "auto"; cursor: pointer; opacity: .6; filter: Alpha(opacity=60);
在assets/themes/twitter/js添加jquery和main.js,main.js内容如下:
jQuery.noConflict(); jQuery(document).ready(function(){ var backToTopTxt = "▲", backToTopEle = jQuery( div /div ).appendTo(jQuery("body")).text(backToTopTxt).attr("title","Back top top").click(function() { jQuery("html, body").animate({ scrollTop: 0 }, 120); }), backToTopFun = function() { var st = jQuery(document).scrollTop(), winh = jQuery(window).height(); (st 200)? backToTopEle.show(): backToTopEle.hide(); //IE6下的定位 if (!window.XMLHttpRequest) { backToTopEle.css("top", st + winh - 166); backToTopEle.hide(); jQuery(window).bind("scroll", backToTopFun); jQuery(div.main a,div.pic a).attr(target, _blank);添加文章版权说明
在_includes/themes/twitter/post.html中文章主体下面添加如下代码:
hr div p strong 本文固定链接: /strong a href={ {page.url}} http://blog.javachen.com/2013/08/31/my-jekyll-config.html /a /p p strong 原创文章,转载请注明出处: /strong a href={ {page.url}} JavaChen Blog /a /p /div
并在assets/themes/twitter/css/style.css中添加如下css代码:
.copyright { margin: 10px 0; padding: 10px 20px; line-height: 1; border-radius: 5px; background: #f5f5f5;添加read more功能
参考Jekyll - Read More without plugin,在index.html找到 ,然后修改为:
{ % if post.content contains " !-- more -- " %} { { post.content | split:" !-- more -- " | first % }} h4 a href={ {post.url}} title=Read more... Read more... /a /h4 { % else %} { { post.content}} { % endif %}
然后,在文章中添加 !-- more -- 即可。
添加搜索栏参考Jekyll Bootstrap - Create Simple Search box,在_includes/themes/twitter/default.html导航菜单下面添加:
form id="search-form" input type="text" id="google-search" placeholder="Search" /form
添加js:
jQuery("#search-form").submit(function(){ var query = document.getElementById("google-search").value; window.open("http://google.com/search?q=" + query+ "%20site:" + "http://blog.javachen.com");添加404页面 使用多说评论 修改博客主体为宽屏模式
git,程序配置文件管理,忽略本地更改 在不同的开发环境(同事与同事之间 开发与测试与生产环境)大概率是不同的。 如果每个人都按普通的流程,Pull然后修改成自己本地的,没有忽略监听更改。 那么当他提交代码时,经常会把配置文件也上传到git仓库中。 会影响其他人的开发。
Npm配置全局安装插件目录以及命令用法扩展 eslint 是一个代码检查的插件,类似sonarqube里面的打码扫描一样,像这种插件的话只需要本地使用,就可以用开发环境的进行依赖包安装。
雨客 微博@JavaChen,这里的所有博客文章来自http://blog.javachen.com/。
相关文章
- Mac os 安装Python Pycharm 配置环境「建议收藏」
- Shopify主题Lorenza模板配置修改
- sudoers修改_sudoers配置使用
- SqlSessionFactory配置
- linux怎样配置yum源_linux修改yum源地址
- 小白想要利用python脚本批量登录网络设备修改配置,看这篇就够了!
- linux redis端口修改端口,linux–redis的安装和配置和开启多个端口「建议收藏」
- Linux的环境变量配置详解
- 克隆centos7后添加新网卡如何修改网络配置使其生效?
- 配置修改Picasa3本地数据库路径
- Vue 配置生产环境、测试环境和开发环境的请求
- 【Android Gradle 插件】settings.gradle 配置文件 ( 配置基本作用 | include 函数用法 | 目录层级配置 | 修改 Module 模块构建脚本名称 )
- SQL Server配置管理:构建最佳性能环境(sqlserver配置管理器)
- Linux下修改JDK内存配置的指南(linux修改jdk内存)
- MySQL改变配置:简单易行的指南(mysql修改配置文件)
- Linux下修改Hosts文件配置(linux改hosts)
- Linux修改网卡IP:简单易行的网络配置方法(linux修改网卡ip)
- 如何在Linux下安装和配置显卡驱动?(linux下显卡驱动)
- 配置Linux下修改网卡配置指南(linux修改网卡)
- 极速简易Redis配置修改之道(怎么修改redis配置)
- 步步为营调整Redis配置的必要技巧(如何修改redis配置)
- 功能Oracle添加新功能修改参数配置(oracle修改参数添加)
- 重新定义安全Redis配置的修改密码(redis配置修改密码)
- Redis 配置优化实现热更新(redis配置修改热更新)
- Redis连接池调整规则配置(redis连接池规则配置)
- Linux下MySQL安装配置MySQL配置参数详解