Permalink
Browse files

first

  • Loading branch information...
0 parents commit 385391f65157e5ae95e2c46b1dd07ddb96ef440c caoxh committed Jan 1, 2012
@@ -0,0 +1,4 @@
+_site/
+*.swp
+*.swo
+.bundle
@@ -0,0 +1,18 @@
+safe: false
+auto: false
+server: false
+server_port: 4000
+baseurl: /
+
+source: ./_source
+destination: ./_site
+plugins: ./_plugins
+
+lsi: false
+pygments: false
+markdown: maruku
+permalink: /:year/:month/:day/:title.html
+
+paginate: 10 # Posts per page on the blog index
+#pagination_dir: blog # Directory base for pagination URLs eg. /blog/page/2/
+
@@ -0,0 +1,166 @@
+# Jekyll category page generator.
+# http://recursive-design.com/projects/jekyll-plugins/
+#
+# Version: 0.1.8 (201108151628)
+#
+# Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
+# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
+#
+# A generator that creates category pages for jekyll sites.
+#
+# To use it, simply drop this script into the _plugins directory of your Jekyll site. You should
+# also create a file called 'category_index.html' in the _layouts directory of your jekyll site
+# with the following contents (note: you should remove the leading '# ' characters):
+#
+# ================================== COPY BELOW THIS LINE ==================================
+# ---
+# layout: default
+# ---
+#
+# <h1 class="category">{{ page.title }}</h1>
+# <ul class="posts">
+# {% for post in site.categories[page.category] %}
+# <div>{{ post.date | date_to_html_string }}</div>
+# <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
+# <div class="categories">Filed under {{ post.categories | category_links }}</div>
+# {% endfor %}
+# </ul>
+# ================================== COPY ABOVE THIS LINE ==================================
+#
+# You can alter the _layout_ setting if you wish to use an alternate layout, and obviously you
+# can change the HTML above as you see fit.
+#
+# When you compile your jekyll site, this plugin will loop through the list of categories in your
+# site, and use the layout above to generate a page for each one with a list of links to the
+# individual posts.
+#
+# Included filters :
+# - category_links: Outputs the list of categories as comma-separated <a> links.
+# - date_to_html_string: Outputs the post.date as formatted html, with hooks for CSS styling.
+#
+# Available _config.yml settings :
+# - category_dir: The subfolder to build category pages in (default is 'categories').
+# - category_title_prefix: The string used before the category name in the page title (default is
+# 'Category: ').
+
+CATEGORIES_NAME = {'tech' => '技术', 'life' => '生活'}
+
+module Jekyll
+
+
+ # The CategoryIndex class creates a single category page for the specified category.
+ class CategoryIndex < Page
+
+ # Initializes a new CategoryIndex.
+ #
+ # +base+ is the String path to the <source>.
+ # +category_dir+ is the String path between <source> and the category folder.
+ # +category+ is the category currently being processed.
+ def initialize(site, base, category_dir, category)
+ @site = site
+ @base = base
+ @dir = category_dir
+ @name = 'index.html'
+ self.process(@name)
+ # Read the YAML data from the layout page.
+ self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
+ self.data['category'] = category
+ # Set the title for this page.
+ title_prefix = site.config['category_title_prefix'] || 'Category: '
+# self.data['title'] = "#{title_prefix}#{category}"
+ self.data['title'] = "#{::CATEGORIES_NAME[category] || category}分类"
+ # Set the meta-description for this page.
+ meta_description_prefix = site.config['category_meta_description_prefix'] || 'Category: '
+ self.data['description'] = "#{meta_description_prefix}#{category}"
+ end
+
+ end
+
+
+ # The Site class is a built-in Jekyll class with access to global site config information.
+ class Site
+
+ # Creates an instance of CategoryIndex for each category page, renders it, and
+ # writes the output to a file.
+ #
+ # +category_dir+ is the String path to the category folder.
+ # +category+ is the category currently being processed.
+ def write_category_index(category_dir, category)
+ index = CategoryIndex.new(self, self.source, category_dir, category)
+ index.render(self.layouts, site_payload)
+ index.write(self.dest)
+ # Record the fact that this page has been added, otherwise Site::cleanup will remove it.
+ self.pages << index
+ end
+
+ # Loops through the list of category pages and processes each one.
+ def write_category_indexes
+ if self.layouts.key? 'category_index'
+ dir = self.config['category_dir'] || 'categories'
+ self.categories.keys.each do |category|
+ self.write_category_index(File.join(dir, category), category)
+ end
+
+ # Throw an exception if the layout couldn't be found.
+ else
+ throw "No 'category_index' layout found."
+ end
+ end
+
+ end
+
+
+ # Jekyll hook - the generate method is called by jekyll, and generates all of the category pages.
+ class GenerateCategories < Generator
+ safe true
+ priority :low
+
+ def generate(site)
+ site.write_category_indexes
+ end
+
+ end
+
+
+ # Adds some extra filters used during the category creation process.
+ module Filters
+
+ # Outputs a list of categories as comma-separated <a> links. This is used
+ # to output the category list for each post on a category page.
+ #
+ # +categories+ is the list of categories to format.
+ #
+ # Returns string
+ def category_links(categories)
+ categories = categories.sort!.map do |item|
+ '<a href="/categories/'+item+'/">'+(::CATEGORIES_NAME[item] || item) +'</a>'
+ end
+
+ connector = "and"
+ case categories.length
+ when 0
+ ""
+ when 1
+ categories[0].to_s
+ when 2
+ "#{categories[0]} #{connector} #{categories[1]}"
+ else
+ "#{categories[0...-1].join(', ')}, #{connector} #{categories[-1]}"
+ end
+ end
+
+ # Outputs the post.date as formatted html, with hooks for CSS styling.
+ #
+ # +date+ is the date object to format as HTML.
+ #
+ # Returns string
+ def date_to_html_string(date)
+ result = '<span class="month">' + date.strftime('%b').upcase + '</span> '
+ result += date.strftime('<span class="day">%d</span> ')
+ result += date.strftime('<span class="year">%Y</span> ')
+ result
+ end
+
+ end
+
+end
@@ -0,0 +1,14 @@
+<div id="disqus_thread"></div>
+<script type="text/javascript">
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
+ var disqus_shortname = 'mangege'; // required: replace example with your forum shortname
+
+ /* * * DON'T EDIT BELOW THIS LINE * * */
+ (function() {
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+ dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+ })();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></A>
@@ -0,0 +1,5 @@
+<div id="footer-container">
+ <div id="footer">
+ <p class="credit">Powered by <a class="wp-link" href="https://github.com/mojombo/jekyll" title="Powered by Jekyll, Jekyll is a simple, blog aware, static site generator. "><span>Jekyll</span></a> and <a class="theme-link" href="http://themehybrid.com/themes/hybrid" title="Hybrid"><span>Hybrid</span></a>.</p></div>
+ </div><!-- #footer -->
+</div><!-- #footer-container -->
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html dir="ltr" lang="zh-CN">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>{% if page.title %}{{ page.title }} - {% endif %}曹小华的博客</title>
+<link rel="stylesheet" href="/stylesheets/style.css" type="text/css" media="all" />
+</head>
@@ -0,0 +1,7 @@
+<div id="primary-menu" class="menu-container">
+ <div class="menu"><ul id="menu" class="">
+<li id="menu-item-1" class="menu-item menu-item-type-custom menu-item-object-custom"><a href="/">首页</a></li>
+<li id="menu-item-1" class="menu-item menu-item-type-custom menu-item-object-custom"><a href="/about.html">关于</a></li>
+ </ul></div>
+</div><!-- #primary-menu .menu-container -->
+
@@ -0,0 +1,9 @@
+<div class="hentry post publish">
+ <h2 class="entry-title"><a href="{{post.url}}" rel="bookmark">{{post.title}}</a></h2>
+ <p class="byline"><abbr class="published">{{post.date}}</abbr>
+ {% unless post.categories == empty %}| <span class="category">{{ post.categories | category_links }}</span>{% endunless %}
+ </p>
+ <div class="entry-content">
+ {{post.content}}
+ </div><!-- .entry-content -->
+</div><!-- .hentry -->
@@ -0,0 +1,19 @@
+<div id="primary" class="sidebar aside">
+ <div id="recent_posts" class="widget recent_posts"><div class="widget-wrap widget-inside">
+ <h3 class="widget-title">最近文章</h3>
+ <ul class="xoxo recent_posts">
+ {% for post in site.posts limit: 10 %}
+ <li><a href='{{post.url}}'>{{post.title}}</a></li>
+ {% endfor %}
+ </ul><!-- .xoxo .recent_posts -->
+ </div></div>
+
+ <div id="hybrid-categories" class="widget categories widget-categories"><div class="widget-wrap widget-inside">
+ <h3 class="widget-title">分类</h3>
+ <ul class="xoxo categories">
+ <li class="cat-item"><a href="/categories/tech" title="电脑方面心得">技术</a></li>
+ <li class="cat-item"><a href="/categories/life" title="梦想与现实">生活</a></li>
+ </ul><!-- .xoxo .categories -->
+ </div></div>
+
+</div><!-- #primary .aside -->
@@ -0,0 +1,7 @@
+---
+layout: default
+---
+
+{% for post in site.categories[page.category] %}
+ {% include post.html %}
+{% endfor %}
@@ -0,0 +1,20 @@
+{% include head.html %}
+<body class="jekyll ltr zh_CN parent-theme logged-out blog gecko primary-active secondary-inactive subsidiary-inactive">
+<div id="body-container">
+ <div id="header-container">
+ <div id="header">
+ <h1 id="site-title"><a href="http://www.mangege.com/" title="曹小华的博客" rel="home"><span>曹小华的博客</span></a></h1>
+ <h2 id="site-description"><span>做点有意义的事</span></h2>
+ </div><!-- #header -->
+ </div><!-- #header-container -->
+ {% include menu.html %}
+ <div id="container">
+ <div id="content" class="hfeed content">
+ {{content}}
+ </div><!-- .content .hfeed -->
+ {% include sidebar.html %}
+ </div><!-- #container -->
+ {% include footer.html %}
+</div><!-- #body-container -->
+</body>
+</html>
@@ -0,0 +1,17 @@
+---
+layout: default
+---
+
+<div class="hentry post publish">
+ <h1 class="post-title entry-title"><a href="{{page.url}}" rel="bookmark">{{page.title}}</a></h1>
+ <p class="byline"><abbr class="published">{{page.date}}</abbr>
+ {% unless page.categories == empty %}| <span class="category">{{ page.categories | category_links }}</span>{% endunless %}
+ </p>
+ <div class="entry-content">
+ {{page.content}}
+ </div><!-- .entry-content -->
+</div>
+
+<div id="comments-template">
+ {% include disqus.html %}
+</div>
@@ -0,0 +1,6 @@
+---
+layout: post
+categories: tech
+---
+
+hello my blog
@@ -0,0 +1,9 @@
+---
+layout: post
+title: KITTY猫
+categories: life
+---
+
+hello kitty
+
+ my love
@@ -0,0 +1,5 @@
+---
+layout: default
+title: 关于
+---
+about me
@@ -0,0 +1,16 @@
+---
+layout: default
+---
+
+{% for post in paginator.posts %}
+ {% include post.html %}
+{% endfor %}
+
+<div class="navigation-links">
+ {% if paginator.next_page %}
+ <a class="previous" href="{{paginator.next_page}}">&larr; Older</a>
+ {% endif %}
+ {% if paginator.previous_page %}
+ <a class="next" href="{{paginator.previous_page}}">Newer &rarr;</a>
+ {% endif %}
+</div>
Oops, something went wrong.

0 comments on commit 385391f

Please sign in to comment.