一個超級酷炫的黑屏靜態博客

git目錄html

這個博客有一個好處,不須要依附於apach或者Nginx,只須要使用jekyll ,速度很快。node

安裝ruby,使用rvm,步驟:(參考)git

1: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

2: \curl -sSL https://get.rvm.io | bash # install RVM (development version)

3: rvm get head # Make Sure RVM up to date

4: rvm install ruby # will install latest version of ruby

5: rvm list # Listing install rubies will you get versions of ruby which is installed by RVM

6:  rvm use < ruby-version > # for instances ruby-1.9.3-p125

安裝博客github

mkdir mymmd
cd mymmd 
git init
git clone https://github.com/karloespiritu/BlackDoc.git
ls
cd BlackDoc/

#安裝js
gem install execjs
gem install therubyracer
gem install bundler
bundle install
yum install nodejs

gem install jekyll

拉起web服務web

jekyll serve --host 'yourhostip'

在瀏覽器中執行 http://yourhostip:4000,就能打開相似這樣的黑屏博客拉 http://karloespiritu.com/blackdoc/ubuntu

如何在github上維護博客 之前在github上搭建過一個jekyll的博客,把整個目錄替換掉,就能夠在github上維護一個博客了。 例子:https://github.com/jesseei/jesseei.github.io瀏覽器

如何不使用插件增長category:ruby

  • 這裏是列表文本在根目錄增長category目錄,裏面按須要的分類增長不一樣的文件夾,文件夾裏增長index.html文件
---
layout: category
title: MalwareMustDie
category: MalwareMustDie
---
  • 在_layouts目錄增長category.html文件
---
layout: page
---
<h2>Posts related to: {{ page.title }}</h2>

{% unless page.content == '' %}
  <p>{{ page.content }}</p>
{% endunless %}

{% unless site.categories.[page.category] | size > 0 %}
  <p>No posts in this category at this time.</p>
{% endunless %}

{% for post in site.categories.[page.category] %}
<div class="post-preview">
    <a href="{{ site.baseurl }}{{ post.url | remove_first: '/'}}">
        <h2 class="post-title">            
            {{ post.title }}
        </h2>
        {% if post.subtitle %}
        <h3 class="post-subtitle">
            {{ post.subtitle }}
        </h3>
        {% endif %}
    </a>
    <p class="post-meta">
      Posted by 
      {% if post.author %}
        {{ post.author }}
      {% else %}
        {{ site.title }}
      {% endif %} 
      on {{ post.date | date: "%B %-d, %Y" }}
    </p>
</div>
<hr>
{% endfor %}
  • 在須要展現分類列表的地方增長以下代碼
<h3>Categories</h3>
{% for category in site.categories %}
    <a href="/category/{{ category[0] }}/" style="text-decoration: none;">{{ category | first }}</a><br />
{% endfor %}
相關文章
相關標籤/搜索