浏览代码

Add collection layout

Daniel Rudolf 9 年之前
父节点
当前提交
5fc79a5094
共有 4 个文件被更改,包括 88 次插入89 次删除
  1. 74 0
      _layouts/collection.html
  2. 6 43
      docs.html
  3. 0 46
      plugin-dev.html
  4. 8 0
      plugin-dev.md

+ 74 - 0
_layouts/collection.html

@@ -0,0 +1,74 @@
+{% include itemumentHeader.html %}
+<head>
+
+    {% include headInclude.html %}
+    <title>{% if page.title %}{{ page.title }} | {{ site.title }}{% else %}{{ site.title }} - {{ site.description }}{% endif %}</title>
+
+</head>
+<body class="full-layout">
+
+    <div class="body-wrapper">
+        <div class="top-wrapper">
+            {% include pageHeader.html %}
+        </div>
+
+        <div class="light-wrapper">
+            <div class="inner">
+                {% if page.headline or page.title %}
+                    <h1 class="aligncenter">
+                        {% if page.headline %}
+                            {{ page.headline | markdownify | remove: '<p>' | remove: '</p>' }}
+                        {% else %}
+                            {{ page.title }}
+                        {% endif %}
+                    </h1>
+                {% endif %}
+                {% if page.description %}
+                    <p class="description aligncenter">
+                        {{ page.description | markdownify | remove: '<p>' | remove: '</p>' }}
+                    </p><br />
+                {% endif %}
+
+                {{ content }}
+
+                {% if page.collection %}
+                    {% assign items = site[page.collection]|sort:"nav" %}
+                    <div class="one-fourth">
+                        <ul>
+                            {% for item in items %}
+                                {% for section in item.toc %}
+                                    <li>
+                                        {% if section[1]._title %}
+                                            <a href="#{{ section[0] }}">{{ section[1]._title }}</a>
+                                            <ul>
+                                                {% for subSection in section[1] %}
+                                                    {% if subSection[0] != "_title" %}
+                                                        <li><a href="#{{ subSection[0] }}">{{ subSection[1] }}</a></li>
+                                                    {% endif %}
+                                                {% endfor %}
+                                            </ul>
+                                        {% else %}
+                                            <a href="#{{ section[0] }}">{{ section[1] }}</a>
+                                        {% endif %}
+                                    </li>
+                                {% endfor %}
+                            {% endfor %}
+                        </ul>
+                    </div>
+                    <div class="three-fourth last">
+                        {% for item in items %}
+                            {{ item.output }}
+                        {% endfor %}
+
+                        <hr />
+                    </div>
+                    <div class="clear"></div>
+                {% endif %}
+            </div>
+        </div>
+
+        {% include pageFooter.html %}
+    </div>
+
+</body>
+{% include itemumentFooter.html %}

+ 6 - 43
docs.html

@@ -1,47 +1,10 @@
 ---
-layout: default
+layout: collection
 title: Docs
+headline: Pico Documentation
+description: |
+    Pico is a flat file CMS, this means there is no administration backend or database to deal with.
+    You simply create .md files in the "content" folder and that becomes a page.
+collection: docs
 nav: 2
 ---
-
-{% assign docs = site.docs|sort:"nav" %}
-<div class="light-wrapper">
-    <div class="inner">
-        <h1 class="aligncenter">Pico Documentation</h1>
-        <p class="description aligncenter">
-            Pico is a flat file CMS, this means there is no administration backend or database to deal with.<br />
-            You simply create .md files in the "content" folder and that becomes a page.
-        </p><br />
-
-        <div class="one-fourth">
-            <ul>
-                {% for doc in docs %}
-                    {% for item in doc.toc %}
-                        <li>
-                            {% if item[1]._title %}
-                                <a href="#{{ item[0] }}">{{ item[1]._title }}</a>
-                                <ul>
-                                    {% for sub in item[1] %}
-                                        {% if sub[0] != "_title" %}
-                                            <li><a href="#{{ sub[0] }}">{{ sub[1] }}</a></li>
-                                        {% endif %}
-                                    {% endfor %}
-                                </ul>
-                            {% else %}
-                                <a href="#{{ item[0] }}">{{ item[1] }}</a>
-                            {% endif %}
-                        </li>
-                    {% endfor %}
-                {% endfor %}
-            </ul>
-        </div>
-        <div class="three-fourth last">
-            {% for doc in docs %}
-                {{ doc.output }}
-            {% endfor %}
-
-            <hr>
-        </div>
-        <div class="clear"></div>
-    </div>
-</div>

+ 0 - 46
plugin-dev.html

@@ -1,46 +0,0 @@
----
-layout: default
-title: Development
-nav: 3
----
-
-{% assign docs = site.plugin-dev|sort:"nav" %}
-<div class="light-wrapper">
-    <div class="inner">
-        <h1 class="aligncenter">Create your own plugins &amp; themes</h1>
-        <p class="description aligncenter">
-            Below is our developer documentation, you may also refer to Picos <a href="{{ site.base_url }}/phpDoc/master/">class documentation</a>
-        </p><br />
-
-        <div class="one-fourth">
-            <ul>
-                {% for doc in docs %}
-                    {% for item in doc.toc %}
-                        <li>
-                            {% if item[1]._title %}
-                                <a href="#{{ item[0] }}">{{ item[1]._title }}</a>
-                                <ul>
-                                    {% for sub in item[1] %}
-                                        {% if sub[0] != "_title" %}
-                                            <li><a href="#{{ sub[0] }}">{{ sub[1] }}</a></li>
-                                        {% endif %}
-                                    {% endfor %}
-                                </ul>
-                            {% else %}
-                                <a href="#{{ item[0] }}">{{ item[1] }}</a>
-                            {% endif %}
-                        </li>
-                    {% endfor %}
-                {% endfor %}
-            </ul>
-        </div>
-        <div class="three-fourth last">
-            {% for doc in docs %}
-                {{ doc.output }}
-            {% endfor %}
-
-            <hr>
-        </div>
-        <div class="clear"></div>
-    </div>
-</div>

+ 8 - 0
plugin-dev.md

@@ -0,0 +1,8 @@
+---
+layout: collection
+title: Development
+headline: Create your own plugins & themes
+description: Below is our developer documentation, you may also refer to Picos [class documentation]({{ site.base_url }}/phpDoc/master/).
+collection: plugin-dev
+nav: 3
+---