Permalink
Browse files

started working on various link issues

  • Loading branch information...
1 parent f392dae commit e1103dba40c224c5320138173ae753d87b0ff733 @natevw committed Dec 26, 2010
Showing with 28 additions and 15 deletions.
  1. +3 −1 blog.json
  2. +2 −4 lib/glob.js
  3. +9 −5 lists/posts.js
  4. +14 −5 templates/theme.html
View
@@ -1,5 +1,7 @@
{
"title": "a glob of nerdishness",
"author": "Nathan Vander Wilt",
- "uri": "http://www.extinguishedscholar.com/wpglob/?feed=atom"
+ "uri": "http://www.extinguishedscholar.com/wpglob/?feed=atom",
+ "base_url-real": "http://nerdishness.extinguishedscholar.com/blog/",
+ "base_url": "http://localhost:5984/dev/_design/glob/_rewrite/blog/"
}
View
@@ -20,11 +20,9 @@ var am_pm = function (hour) {
return (hour < 12) ? "am" : "pm";
};
-exports.postToTheme = function (doc, url) {
+exports.postToTheme = function (doc, base_url) {
var d = doc.published.match(published_re);
doc.published_human = d[1] + " " + months[d[2]] + " " + parseInt(d[3]) + ", " + parseInt(d[4]) + ":" + d[5] + am_pm(d[4]);
- if (url) {
- doc.url = url;
- }
+ doc.url = base_url + doc.path;
return doc;
};
View
@@ -1,18 +1,22 @@
function(head, req) {
var ddoc = this;
var path = path = require("lib/path").init(req);
+
var indexPath = path.list('posts','by_date',{reduce:false, descending:true, limit:10, include_docs:true});
var feedPath = path.list('posts','by_date',{reduce:false, descending:true, limit:10, include_docs:true, format:"atom"});
provides("html", function () {
var Mustache = require("lib/mustache");
var postToTheme = require("lib/glob").postToTheme;
var path = require("lib/path").init(req);
- var list = function () { var row = getRow(); return row && postToTheme(row.doc); }
+ var list = function () { var row = getRow(); return row && postToTheme(row.doc, ddoc.blog.base_url); }
list.iterator = true;
- var single = Boolean(req.query.key); // assume only one post per view key
- var post = (single) ? list() : list;
- return Mustache.to_html(ddoc.templates.theme, {single:single, post:post}, ddoc.templates.partials);
+
+ var data = {};
+ data.single = Boolean(req.query.key); // assume only one post per view key
+ data.post = (data.single) ? list() : list;
+ data.base_url = ddoc.blog.base_url;
+ return Mustache.to_html(ddoc.templates.theme, data, ddoc.templates.partials);
});
provides("atom", function () {
// hat tip to https://github.com/jchris/sofa/blob/master/lists/index.js
@@ -28,7 +32,7 @@ function(head, req) {
while (row) {
var post = row.doc;
- post.alternate = path.absolute(path.show('post', row.id));
+ post.alternate = ddoc.blog.base_url + post.path;
send(Atom.entry(post));
row = getRow();
}
View
@@ -3,6 +3,10 @@
<head>
<meta charset="UTF-8">
<title>{{#single}}{{#post}}{{ title }}{{/post}} - {{/single}}a glob of nerdishness</title>
+
+<link rel="index" title="a glob of nerdishness" href="{{ base_url }}">
+<link rel="alternate" type="application/atom+xml" title="Feed" href="{{ base_url }}?format=atom">
+
<style>
/* http://html5doctor.com/html-5-reset-stylesheet/#comment-454 */
body { margin:0; padding:0; }
@@ -25,7 +29,7 @@
body > header h1 { font-size: 250%; margin: 0em; }
body > header h2 { font-size: 90%; font-weight: normal; margin: 0em; }
- article { clear: both; padding: 2em; max-width: 50em; }
+ article { clear: both; padding: 2em; max-width: 635px; }
article { text-align: justify; line-height: 1.5em; }
article > header h1 { font-size: 125%; margin: 0em; }
article > header p { font-size: 90%; margin: 0em; padding: 0em; }
@@ -49,11 +53,13 @@
<header{{#single}} class="single"{{/single}}>
<img src="../../logo.png">
-{{^single}}
+{{#single}}
+<h1><a href="{{ base_url }}" class="subtle">a glob of nerd­ish­ness</a></h1>
+{{/single}}{{^single}}
<p>
<a href="http://twitter.com/natevw" class="subtle">natevw</a> proudly presents:
-{{/single}}
<h1>a glob of nerd­ish­ness</h1>
+{{/single}}
<h2>Powered by work over time.</h2>
</header>
@@ -64,8 +70,7 @@
<h1>{{ title }}</h1>
<p>
written by <a href="http://twitter.com/natevw" class="subtle">natevw</a> on <time datetime="{{ published }}" pubdate>{{ published_human }}</time>
-{{/single}}
-{{^single}}
+{{/single}}{{^single}}
<time datetime="{{ published }}" pubdate>{{ published_human }}</time>
<h1><a href="{{ url }}" rel="bookmark" class="expected">{{ title }}</a></h1>
{{/single}}
@@ -77,6 +82,10 @@
</article>
{{/ post }}
+{{^single}}
+<!-- TODO: "older" link -->
+{{/single}}
+
<footer>
<small>Copyright © 2007–2011 Nathan Vander Wilt. All rights reserved. Limit one offer per coupon.</small>
</footer>

0 comments on commit e1103db

Please sign in to comment.