Permalink
Browse files

Using new file structure and single html template

  • Loading branch information...
1 parent 44856ee commit 0b793a39466799afb0aff6189f9df9ff668f7c0f @jkriss committed Nov 27, 2011
Showing with 53 additions and 26 deletions.
  1. +3 −2 README.markdown
  2. +0 −22 layouts/post.html.liquid
  3. +25 −0 templates/atom.xml.liquid
  4. +25 −2 layouts/page.html.liquid → templates/index.html.liquid
View
5 README.markdown
@@ -7,12 +7,12 @@ Gitstuff is kind of like Tumblr, but with everything stored in Github, and you c
These things follow a very simple structure:
- Posts go in /posts
-- Layouts go in /layouts
+- Templates go in /templates
- Assets go in /assets
Individual posts have metadata up top, and content on the bottom, much like [Jekyll](https://github.com/mojombo/jekyll).
-Gitstuff expects two layout files, `page.html.liquid` and `post.html.liquid`. They use (you guessed it), [Liquid markup](http://liquidmarkup.org/).
+Gitstuff expects a template file, `index.html.liquid`. You may also have a `atom.xml.liquid` file. They use (you guessed it), [Liquid markup](http://liquidmarkup.org/).
### Variables
@@ -24,6 +24,7 @@ The post template is passed all of the metadata for your post, plus the content
- modified_at
#### Context information
+- post (a collection of the posts for the page)
- single_post (true or false)
- search_form (an html snippet for the search form)
- query (the current search query, if present)
View
22 layouts/post.html.liquid
@@ -1,22 +0,0 @@
-<div class="drink" style="border-color: {{ color }}">
- <h1>
- {% if single_post %}
- {{ title }}
- {% else %}
- <a href="{{ url }}">{{ title }}</a>
- {% endif %}
- <span class="glass">{{ glass_type }} glass</span>
- {% if tag | split:" " | contains 'fave' %}
- <div class="star" style="color: {{ color }}">&#9733;</div>
- {% endif %}
- </h1>
- <div class="content">
- {{ content }}
- </div>
- <div class="footer">
- {% if author %}
- Added by {{ author.name | split:" " | first }} on
- <span class="date">{{ created_at | date: '%b %d %Y' }}</span>
- {% endif %}
- </div>
-</div>
View
25 templates/atom.xml.liquid
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+
+ <title>The Liquor Cabinet</title>
+ <link href="{{ root_path }}/atom.xml" rel="self"/>
+ <link href="http://{{ root_path }}"/>
+ {% assign most_recent_post = posts | first %}
+ <updated>{{ most_recent_post.modified_at | date_to_xmlschema }}</updated>
+ <id>{{ root_path }}</id>
+ <author>
+ <name>Jesse Kriss</name>
+ <email>jesse@jklabs.net</email>
+ </author>
+
+ {% for post in posts %}
+ <entry>
+ <title>{{ post.title }}</title>
+ <link href="{{ post.url }}"/>
+ <updated>{{ post.modified_at | date_to_xmlschema }}</updated>
+ <id>{{ post.url }}</id>
+ <content type="html">{{ post.content | xml_escape }}</content>
+ </entry>
+ {% endfor %}
+
+</feed>
View
27 layouts/page.html.liquid → templates/index.html.liquid
@@ -214,8 +214,31 @@
{% elsif query %}
<div id="query">Drinks matching <strong>{{ query }}</strong></div>
{% endif %}
-
- {{ content }}
+
+ {% for post in posts %}
+ <div class="drink" style="border-color: {{ post.color }}">
+ <h1>
+ {% if single_post %}
+ {{ post.title }}
+ {% else %}
+ <a href="{{ post.url }}">{{ post.title }}</a>
+ {% endif %}
+ <span class="glass">{{ post.glass_type }} glass</span>
+ {% if post.tag | split:" " | contains 'fave' %}
+ <div class="star" style="color: {{ post.color }}">&#9733;</div>
+ {% endif %}
+ </h1>
+ <div class="content">
+ {{ post.content }}
+ </div>
+ <div class="footer">
+ {% if post.author %}
+ Added by {{ post.author.name | split:" " | first }} on
+ <span class="date">{{ post.created_at | date: '%b %d %Y' }}</span>
+ {% endif %}
+ </div>
+ </div>
+ {% endfor %}
{% unless single_post %}
<div class="paging">

0 comments on commit 0b793a3

Please sign in to comment.