Octopress+Github博客搭建

        我的Blog:http://buendiya.github.io/

步骤

1、Hello World

         按照http://pages.github.com/进行操作。操作成功,在http://buendiya.github.io/显示”Hello,World”。

2、用自动Github提供的automaticgenerator生成页面

         https://help.github.com/articles/creating-pages-with-the-automatic-generator

         按照该页面提示的步骤执行,第3步里把要在页面上显示的内容填入Markdown editor。完成后,即可显示。

3、Octopress

         因为在windows下配置Jekyll的环境太过麻烦,参考http://shanewfx.github.io/blog/2012/02/16/bulid-blog-by-octopress/用Octopress搭建博客。

         Octopress:http://octopress.org/

         source文件夹就是我们以后工作的目录,source中有个_posts文件夹,这就是保存每一篇blog的地方了。     

1)配置博客,包括:博客的名字、作者、排版等。

         http://octopress.org/docs/configuring/

         通过修改_config.yml来配置博客的基本信息。

2)  Blogging Basics

         http://octopress.org/docs/blogging/介绍了如何post一篇新的博客,包括文章内容的格式、预览功能。

         Blog posts must be stored in the source/_posts directory

3)写完一篇新的博客后,部署Deploying的流程

         http://octopress.org/docs/deploying/github/

         只有第一次deploy的时候才需要执行’rake setup_github_pages’。

        在ocropress目录下执行:

        rake generate                   //在public生成新的文件

        rake deploy                         //将’rakegenerate’生成的文件拷贝到_deploy目录下

         This will generate your blog, copy the generated files into _deploy/, add them to git, commit and push them up to the masterbranch.

       该命令会自动将在_deploy目录下新生成的文件pushGithub

4)  rakesetup_github_pages

        This will:

Ask for and store your Github Pages repository url.

Rename the remote pointing to imathis/octopress from'origin' to 'octopress'

Add your Github Pages repository as the default origin remote.

Switch the active branch from master to source.

Configure your blog's url according to your repository.

Setup a master branch in the _deploy directoryfor deployment.

        这个命令的内部执行过程。

5)octopress下各目录结构

         在Rakefile里有注明。

public_dir      = "public"    # compiled site directory

source_dir      = "source"    # source file directory

blog_index_dir  = 'source'   # directory for your blog's index page (if you put your index insource/blog/index.html, set this to 'source/blog')

deploy_dir      = "_deploy"   # deploy directory (for Github pagesdeployment)

stash_dir       = "_stash"    # directory to stash posts for speedygeneration

posts_dir       = "_posts"    # directory for blog files

themes_dir      = ".themes"   # directory for blog files

new_post_ext    = "markdown"  # default new post file extension when usingthe new_post task

new_page_ext    = "markdown"  # default new page file extension when usingthe new_page task

server_port     = "4000"      # port for preview server eg.localhost:4000

         http://blog.csdn.net/lcliliil/article/details/13724343

         这篇文章里也有不错的介绍。

6)装饰边栏

http://icodeit.org/2013/01/add-new-page-to-octopress/

         在source/_includes/asides/目录下创建相应的html文件;在_config.yml文件的default_asides里添加刚才的文件名称;

7)添加新页面

http://icodeit.org/2013/01/add-new-page-to-octopress/

         1)新的页面文件存放在source下一个单独的目录里,该目录内放置相应的index.markdown文件;

         2)修改source/_includes/custom/navigation.html文件,将1)中新建文件的路径添加到该文件里。

         注意路径,如: 

  • About Me
  • ,表示source目录下的aboutme文件夹下放置的index.markdown文件。

    8)增加评论和分享功能

             http://baham.co/01_16_octopressshi-yong-disqusliu-yan-xi-tong.html

    1)  在disqus上注册一个账号,Add Disqusto your site,获取shortname.

    2)  配置_config.yml文件,将1)中获取的shortname填写在”disqus_short_name:shortname”。

    9)添加标签云-Tag Cloud

             http://yang3wei.github.io/blog/2013/01/30/zhuan-zai-wei-octopress-tian-jia-biao-qian-yun/

             需要拷贝插件,然后6)的方法添加Tag栏。

    4、Markdown语法介绍

             http://daringfireball.net/projects/markdown/syntax

             http://wowubuntu.com/markdown/index.html#code

             http://www.ituring.com.cn/article/23

    Note

    1、User,Organization and Project Pages

            https://help.github.com/articles/user-organization-and-project-pages#project-pages

            There are two basic types of Pages available, User/Organization Pages and Project Pages.

    1)  User/Organization Pages 

    This repository must use the username/username.github.io naming scheme.

    Content from the master branch will be used to build and publish the Pages.

    2)  Project Pages

    The gh-pages branch is used to build and publish from.

    custom domain on user/org pages will apply the same domain redirect to all project pages hosted under that account, unless the projectpages use their own custom domain.

    If no custom domain is used, the project pages are served under a subpath of the user pages:username.github.io/projectname

    Custom 404s will only work if a custom domain is used,otherwise the User Pages 404 is used.

    2、

           Every GitHub Page is run through Jekyll when you push content to a specially named branch within your repository.

           个人在repository里提交的网页内容都是通过Jekyll显示的。

    参考文档:

    Create Blog:

    http://buendiya.github.io/,

    https://help.github.com/categories/20/articles

    http://octopress.org/

    http://xiaohudie.net/code/octopress-install.html

    http://shanewfx.github.io/blog/2012/02/16/clone-blog-from-github/

    http://ishalou.com/blog/2012/10/15/how-to-use-octopress/

     

    Configure Blog:

    http://biaobiaoqi.me/blog/2013/07/10/decorate-octopress/

    http://icodeit.org/2013/01/add-new-page-to-octopress/


    你可能感兴趣的:(Git)