Giter Site home page Giter Site logo

powerjekyll's Introduction

Power Jekyll

Power Jekyll是一个用于管理Jekyll博客的PowerShell模块,它通过blog命令提供了一组命令,可以方便地进行博客的本地开发、创建、发布等操作

功能

通过blog命令提供了以下功能:

  • serve: 在本地通过Jekyll启动博客服务器
  • list: 列出所有的博文和草稿
  • open: 在编辑器中打开指定的博文或草稿
  • remove: 删除一个博文或草稿
  • draft: 创建一个位于_drafts目录下的新草稿
  • post: 创建一个位于_posts目录下的新博文
  • publish: 发布一个草稿,将其移动到_posts目录下
  • unpublish: 撤销一篇已发布的博文,将其移动回_drafts目录

其他功能

  • 自动补全子命令
  • 自动补全命令相关文件名

安装

在使用之前,你需要额外安装一些依赖,可以在你的Python环境中进入到本程序目录,使用下面的命令安装

pip install -r requirements.txt

安装完成后,你可以在PowerShell中通过Import-Module命令导入模块,类似下面的命令

Import-Module -Name "本程序目录的绝对路径"

或将程序目录移动到PowerShell的模块安装目录中,安装目录路径可通过PSModulePath环境变量查看

移动后,PowerShell会自动加载模块,或通过Import-Module命令导入

Import-Module PowerJekyll

最后需要设置环境变量BLOG_ROOT为你的博客目录,你可以在系统控制面板中添加,也可在PowerShell中执行下面的命令设置环境变量

[Environment]::SetEnvironmentVariable('BLOG_ROOT', '你的博客目录全路径', 'User')

关于config.yml

config.yml中可以配置博客的格式头yaml fomatter,在使用postdraft命令时,会使用配置的格式头初始化文档

# yaml formatter
formatter:
  draft:
    layout: post
    title:
    categories: []
    tags: []

  post:
    layout: post
    title:
    categories: []
    tags: []
    date:  

使用示例

下面是一些使用示例:

# 启动本地服务器
blog serve
blog s

# 列出所有的博文和草稿
blog list
blog l

# 创建一个新的草稿
blog draft my-draft
blog d my-draft
blog do my-draft  # 创建草稿后自动打开

# 创建一个新的博文
blog post my-post
blog p my-post
blog po my-post  # 创建博文后自动打开

# 删除一个草稿或博文
blog remove my-file
blog r my-file

# 打开指定的博文或草稿
blog open my-post
blog o my-post

# 发布一个草稿
blog publish my-draft
blog pub my-draft

# 撤销发布一篇已发布的博文
blog unpublish my-post
blog unpub my-post

powerjekyll's People

Contributors

baymax104 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.