Home jekyll post page 生成脚本
Post
Cancel

jekyll post page 生成脚本

脚本功能:

  1. md 文件创建
  2. md 头内容生成
  3. 生成随机短地址作为permalink,以便为每个page实现固定地址

脚本内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash

DIR="${0%/*}"

title=`echo [email protected] | sed 's/[ ][ ]*/-/g'`
post_date=`date  +"%Y-%m-%d %T"`
post_name="`date "+%Y-%m-%d"`-${title}.markdown"
random_addr=`openssl rand -hex 8 | md5 | cut -c1-8`

cat > ${DIR}/../_posts/${post_name} << EOF
---
layout: post
title:  "${title}"
description: ""
date:   ${post_date} +0800
categories: default
permalink: /posts/${random_addr}/
tags: [writing]
---

EOF


使用方法:

1
./new_post.sh <the new page name>
This post is licensed under CC BY 4.0 by the author.

containerd导入本地镜像的一个小坑

如何在nginx创建临时重定向和永久重定向

Comments powered by Disqus.