美文网首页
用Octopress在github发文章

用Octopress在github发文章

作者: 欧悦服务 | 来源:发表于2014-08-28 15:51 被阅读146次

参考别人的文章,做了自己的记录。

1.准备工作

首先你必须要有以下的几样东西:

  1. git,以及github.com帐号,(我这里将blog放置在github上,没有就赶紧注册吧)

  2. ruby的开发环境,我这使用的Octopress需要Ruby1.9.2,这些我都有了

2.安装Octopress

git clone git://github.com/imathis/octopress.git octopress
cd octopress
gem install bundler  # 安装ruby1.9.2下的bundler
bundle install       # 安装依赖的组件
rake install         # 安装默认的Octopress主题

3.配置github

在github上创建一个仓库,注意仓库名称要以下这种格式yourname.github.io,这样代码发布后自动这个url就可以访问了。

设定 GitHub Pages

rake setup_github_pages

中间会有要求输入用户名地址之类的,照做就好了。

rake generate
rake deploy

如果发布失败,提示版本不同步,可以执行以下操作:

octopress$ cd _deploy

_deploy$ git pull https://github.com/weipipi/weipipi.github.io

_deploy$ git push origin master

octopress$ rake deploy

4.将 source 也加入 git

git add .
git commit -m 'initial source commit'
git push origin source

5.更新 Octopress

日后有 Octopress 新版本发布,使用以下指令升级。

git remote add octopress git://github.com/imathis/octopress.git
git pull octopress master     # Get the latest Octopress
bundle install                # Keep gems updated
rake update_source            # update the template's source
rake update_style             # update the template's style

6.发表新文章

rake new_post["新文章名称"]

会在“source/_posts”目录下自动生成“Timestamp-qing-song-an-zhuang-octopress.markdown”,编辑后即可发布.

rake preview

会在本地启动sinatra服务,用浏览器打开 http://localhost:4000 就可以看到效果了。如果都没有问题就可以发布了。

7.发布

rake gen_deploy
rake deploy                 #若发布后无效果可试试此命令

8.配置

  • 配置文件为(_config.yml):

按已有的项目改想改的内容就可以了。

修改后需要rake generate和rake deploy

  • Jekyll & Plugins

    paginate: 10 # 每页的文章数量,超过翻页
    recent_posts: 5 # 右侧“最近发表”的模块里显示的文章数量
    excerpt_link: "Read on →" # 在文章中使用,列表页将不再显示全文,而是显示“Read on”的链接,指向全文
    default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html] # 用于配置侧边栏

为Octopress修改主题和自定义样式

修改网站背景或者配色后,需要rake generate才能生效

相关文章

  • 用Octopress在github发文章

    参考别人的文章,做了自己的记录。 1.准备工作 首先你必须要有以下的几样东西: git,以及github.com帐...

  • Markdown常用语法

    前言 最近开始学习写博客了,用GitHub + Octopress 搭建了自己的博客,那么也同时开启了简书。虽然还...

  • octopress博客搭建和个性化配置

    使用octopress搭建博客的人,大概都会喜欢写关于如何搭建配置octopress的文章。因为它的高定制性,为极...

  • 基于 Octopress & Github Pages

    经过上一篇,我们在本地搭出了 Octopress 雏形,这一篇首先我们要将本地的 Octopress 博客部署到 ...

  • 基于 Octopress & Github Pages

    一直以来想有个属于自己的博客空间,或许是出于一种归属感吧。就这样知道了 WordPress、Jekyll、Hexo...

  • 基于 Octopress & Github Pages

    一直以来想有个属于自己的博客空间,或许是出于一种归属感吧。就这样知道了 WordPress、Jekyll、Hexo...

  • 用Octopress搭博客

    今天写一篇技术文章,是的,技术文章,让小清新暂时死一下。 我昨天折腾了一下午的用Octopress搭博客,独立博客...

  • 用Octopress搭建博客

    用Octopress把博客顺利搭建了起来,所遇到的问题也都顺利解决。 之前在用Wordpress的时间里,它一度让...

  • github/octopress/blog/windows环境搭

    最近本人一直关注简书,看过了很多相关文章,它的开发更多的是为了广大的非技术爱好者开发,同时也为广大的技术入门者学习...

  • 从octopress到hexo

    以前一直在用octopress,后来因为自己的电脑的数据被清了,所以只能又从github那边同步代码下来。结果同步...

网友评论

      本文标题:用Octopress在github发文章

      本文链接:https://www.haomeiwen.com/subject/srlytttx.html