From d032b39fe11cafd58030758aaf621b8cb518cd6c Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Tue, 14 Oct 2014 10:13:45 -0400 Subject: [PATCH] initial conversion from wordpress -> wintersmith --- .gitignore | 4 + Makefile | 18 + config.json | 27 ++ contents/about.md | 3 + contents/archive.json | 3 + contents/articles/cocode-is-bad-code/index.md | 41 ++ .../how-to-contribute-to-open-source/index.md | 94 ++++ contents/authors/brett.json | 5 + contents/authors/colin.json | 5 + contents/css/main.css | 435 ++++++++++++++++++ contents/feed.json | 4 + package.json | 10 + plugins/paginator.coffee | 91 ++++ readme.md | 4 + templates/archive.jade | 34 ++ templates/article.jade | 25 + templates/author.jade | 8 + templates/feed.jade | 25 + templates/index.jade | 29 ++ templates/layout.jade | 36 ++ 20 files changed, 901 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 config.json create mode 100644 contents/about.md create mode 100644 contents/archive.json create mode 100644 contents/articles/cocode-is-bad-code/index.md create mode 100644 contents/articles/how-to-contribute-to-open-source/index.md create mode 100644 contents/authors/brett.json create mode 100644 contents/authors/colin.json create mode 100644 contents/css/main.css create mode 100644 contents/feed.json create mode 100644 package.json create mode 100644 plugins/paginator.coffee create mode 100644 readme.md create mode 100644 templates/archive.jade create mode 100644 templates/article.jade create mode 100644 templates/author.jade create mode 100644 templates/feed.jade create mode 100644 templates/index.jade create mode 100644 templates/layout.jade diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e515729 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +build +node_modules +npm-debug.log +contents/css/main.min.css diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b24bbe0 --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +WINTERSMITH = ./node_modules/.bin/wintersmith + +build: + @./node_modules/.bin/cleancss ./contents/css/main.css > ./contents/css/main.min.css + @$(WINTERSMITH) build + +clean: + @rm -rf build + +preview: build + @$(WINTERSMITH) preview + +pull: + git pull + +update: pull build + +.PHONY: build clean preview pull update diff --git a/config.json b/config.json new file mode 100644 index 0000000..53ded1e --- /dev/null +++ b/config.json @@ -0,0 +1,27 @@ +{ + "locals": { + "url": "http://theworstprogrammerever.com", + "name": "The Worst Programmer Ever", + "owner": "The Worst Programmer Ever", + "description": "The best advice from the worst programmers" + }, + "plugins": [ + "./plugins/paginator.coffee" + ], + "require": { + "moment": "moment", + "_": "underscore", + "typogr": "typogr" + }, + "jade": { + "pretty": true + }, + "markdown": { + "smartLists": true, + "smartypants": true, + "gfm": true + }, + "paginator": { + "perPage": 3 + } +} diff --git a/contents/about.md b/contents/about.md new file mode 100644 index 0000000..b3f78e3 --- /dev/null +++ b/contents/about.md @@ -0,0 +1,3 @@ +--- +view: none +--- diff --git a/contents/archive.json b/contents/archive.json new file mode 100644 index 0000000..0fd2fd3 --- /dev/null +++ b/contents/archive.json @@ -0,0 +1,3 @@ +{ + "template": "archive.jade" +} diff --git a/contents/articles/cocode-is-bad-code/index.md b/contents/articles/cocode-is-bad-code/index.md new file mode 100644 index 0000000..b410487 --- /dev/null +++ b/contents/articles/cocode-is-bad-code/index.md @@ -0,0 +1,41 @@ +--- +title: Co-Code is Bad Code +author: colin +date: 2014-10-14 +template: article.jade +--- + +Learn why co-coding isn't all it is cracked up to be. + +--- + +I’m sure you’ve all heard that your whole team should take ownership of the code base, +and that pair programming really speeds up clean development, but let me lay something +down. Very often this results in what they call “too many cooks in the kitchen”. + +Usually this will lead to unending arguments about implementation, and your “partner” +isn’t willing to see the logic in your argument. So we have made a systematic change +to remove pair programming from the process, but this left us with another issue. +I would build something up, and it would be working perfectly fine. I’d commit it to +source control, and come back in later, only to find that my “partners” had refactored +my perfectly functioning code! If it’s not broke, don’t fix it! + +They clutter up the project with different files! Why bother separating the code out +into different files, if it’s already functioning? Another problem here, is that you +actually need to go to different files to view code that was previously right under +your nose. (ctrl + f anyone?) + +It’s just so much easier to trace through the entire stack right in the same file. +You set up your html, and throw your business logic in there too, and make calls +to the database right in line. Then there is no navigating through hundreds of +files that are really just an excuse to waste time. + +They’d argue back that it’s hard to understand, and really, it’s just because they +aren’t smart enough, or they aren’t willing to try. It’s all right there, and you +won’t lose your train of thought switching between files or by having to navigate +through inheritance structures. If you feel like the file is too cluttered, you +can always just use one letter for variable and method names. + +I’ve made it a rule, that if someone touches my code, I will rebase to the point +at which I last touched it, regardless of any other changes they have made along +the way. This has deterred these cowboy coders from jumping in where they don’t belong. diff --git a/contents/articles/how-to-contribute-to-open-source/index.md b/contents/articles/how-to-contribute-to-open-source/index.md new file mode 100644 index 0000000..a6ab273 --- /dev/null +++ b/contents/articles/how-to-contribute-to-open-source/index.md @@ -0,0 +1,94 @@ +--- +title: How to Contribute to Open Source +author: brett +date: 2014-10-14 +template: article.jade +--- + +Learn how to get started in the big and scary Open Source community. + +--- + +You are obviously here because you are interested in learning about contributing to the +open source community. We all tend to aspire to be the a programmer that the community +knows and recognizes by their name and contributions. This is a very difficult place to +get your foot in the door and get started with, but if you follow my simple steps you +will be an open source master in no time. + +## Picking an Open Source Project +This is probably one of the most difficult steps in starting your road to open source +contributions. Picking which project you want to contribute to. Contrary to popular +belief you do not need to pick a project that you have used before or are even interested +in. As well, it is not necessary to have a knowledge base that aligns with that of the +project. For example, I have always wanted to call myself a linux kernel programmer, +this is something I have never done before and do not even have much interest in, but +it sure would be cool if I could tell my friends and co-workers that I was a linux kernel +developer. So I have decided that I am going to contribute to the [linux kernel](https://www.kernel.org/). + +## Prepping to Contribute +To some people contributing to a project that they know nothing about is an easy task, +but truth be told it is not. Some people will struggle with it; therefore, I think it +is necessary to cover some of the steps I use to prepare for contributing to a new project. +I start with an extra large [Pre-Boosted Jamba Juice Smoothie](http://www.jambajuice.com/menu-and-nutrition/menu/smoothies/pre-boosted) +immediately followed by a rigorous spin class to get my blood pumping. Now that your feeling +nice and healthy you need to ensure that you look the part; this usually consists of an +Italian hand made suit, but a tuxedo will work in case your tailor is currently out of town. +Now, you are ready to tackle the world and it is time to devote some of this prep time to the +project at hand. + +All that is really required is a quick glance at the wikipedia page for the topic, in my case +[Linux Kernel](http://en.wikipedia.org/wiki/Linux_kernel). Do not waste too much time reading +the wikipedia page, since some of the articles can be fairly long, my article alone has more +than 200 words (there is no way I am reading all of them). Usually just reading the introduction +and skimming the table of contents will give you enough information so that you sound like you know +what your talking about (since that is all that is needed). + +## Making Your First Open Source Contribution +Ok, so lets do this! What should we contribute? We want to make sure that we contribute something +of merit to the project as well as something that other people will notice, since we really just +want people to recognize us as being helpful contributors to the project. You should always start +off small and work your way towards larger contributions. Let us start with opening an issue ticket. +Most maintainers love issue tickets, it is how they get good (and bad) feedback from the users of +their software. It also will help drive the development of the project. If you open a ticket +asking for a feature or a bug fix then the maintainer(s) will have to work on it. + +Picking an issue to report about can sometimes be a very difficult task, but luckily I have a quick +and simple tip. Start by picking an already exiting ticket, preferably something that has been in +the backlog for a very long time, and simple create a new ticket asking for the same feature or +fix. Sometimes maintainers get very busy with other work and will forget about an issue, so it is +usually best to try and flood their ticket system with repeat issues so they do not forget about them. + +For my first contribution I have decided to pick [this issue](https://bugzilla.kernel.org/show_bug.cgi?id=13868). +It is a perfect candidate since it has not been updated since 2009 (remember, the older the better). +As well as being old, it just sounds important. A memory leak? That sounds serious. I am shocked the +maintainers have not fixed this issue yet. Remember it is not enough to just comment on the original +ticket, instead we want to open a new ticket (this way it’ll show up as being new and not from 2009). +I highly advise trying to re-word the original ticket rather than simply copy/pasting, but sometimes +the original words are big and hard to understand and copy/paste might be the only/best way to ensure +that you get your point across. + +That is it, following these easy steps you have just made a worth while and ever lasting contribution +to the project of your dreams. You are now one step closer to being able to call yourself an open +source linux kernel developer. + +## Follow Up Contributions +Making only a single contribution to a project does not get you known in the community. You need to +continue the above process as often as you can to ensure that those who are directly involved with +the project know who you are. The more you contribute the faster you will get noticed. Contributing +the same thing over and over again can get boring, so remember, you need to switch up your +contributions from time to time. This means that you cannot just continue to open repeat tickets +over and over again, it will get boring very quickly. So make sure that you comment on a few tickets +here or there, even if you do not know what the issue is, just try to remember the few tidbits of +information that you have picked up from scanning wikipedia and the other issue tickets you have read. + +People think contributing to projects is all about writing code, but this is a very common misconception, +you can get by with just creating and commenting on project issue tickets. Plus, no one actually reads the +code or git history to see who has contributed to a project. Instead they are more inclined to monitor and +notice the contributors to the issue or ticket system for the project. + +## Conclusion +That is about it. You have now contributed to the project of your dreams and can call yourself a contributing +open source developer. Make sure to add this project to your website and your resume so people will known to +associate you with that project (I am adding “linux kernel developer” to my resume right now!). Now that you +are well known for one project you can move on to the next and next until you are known all across the internet +for your valuable contributions to all sort of projects. diff --git a/contents/authors/brett.json b/contents/authors/brett.json new file mode 100644 index 0000000..87756a3 --- /dev/null +++ b/contents/authors/brett.json @@ -0,0 +1,5 @@ +{ + "name": "Brett Langdon", + "website": "http://brett.is", + "bio": "Brett is the breaker of things" +} diff --git a/contents/authors/colin.json b/contents/authors/colin.json new file mode 100644 index 0000000..7dca3c7 --- /dev/null +++ b/contents/authors/colin.json @@ -0,0 +1,5 @@ +{ + "name": "Colin Higgins", + "website": "http://developerspyke.com", + "bio": "" +} diff --git a/contents/css/main.css b/contents/css/main.css new file mode 100644 index 0000000..bf22294 --- /dev/null +++ b/contents/css/main.css @@ -0,0 +1,435 @@ + +h1, h2, h3, h4, h5, h6, p, body, a, img, ul, ol, blockquote, pre { + margin: 0; padding: 0; border: 0; +} + +body { + font-family: 'Lora', serif; + font-size: 21px; + line-height: 1.52; + background-color: #f8f8f8; + text-rendering: optimizeLegibility; +} + +.content-wrap { + width: 34em; + margin: 0 auto; +} + +body, a { + color: #171717; +} + +a:hover { + color: #ff8000; + text-decoration: underline; +} + +p { + margin-bottom: 1.52em; +} + +pre { + font-size: 0.9em; + overflow: auto; + background: #fff; + border: 1px dashed #d2d2d2; + border-radius: 0.25em; + margin-bottom: 1.8em; + padding: 1em; +} + +h1 { + font-size: 2em; + margin-bottom: 1em; +} + +h2 { + font-size: 1.2em; + font-weight: 600; + line-height: 1.43; + margin-bottom: 1.35em; +} + +h3 { + font-style: italic; + text-align: center; + font-weight: 400; + font-size: 1.4em; + margin-top: 1.8em; + margin-bottom: 0.8em; +} + +ol, ul { + margin: 0 1.4em 1.4em 4em; +} + +li { + margin-bottom: 0.5em; +} + +blockquote { + margin: 1.2em 3em; + padding-left: 1em; + font-style: italic; +} + +hr { + border: 0; + border-top: 1px dashed #d2d2d2; + height: 0; + margin: 1.6em 0; +} + +/* page header */ + +.header { + margin: 3em 0 5em; +} + +.header h1 { + font-size: 2.0em; + text-align: center; + font-weight: 700; + margin: 0; +} + +.header a, .header a:hover { + text-decoration: none; + color: #171717; +} + +.header .author { + font-family: 'Merriweather', serif; + font-variant: small-caps; + text-transform: lowercase; + text-rendering: auto; + text-align: center; + font-weight: 400; + letter-spacing: 1px; +} + +.header .description { + font-size: 1.2em; + font-style: italic; + text-align: center; + margin-top: -0.3em; +} + +body.article-detail > header h1 { + font-size: 2em; + font-style: italic; + font-weight: 400; + margin-bottom: -0.2em; +} + +body.article-detail > header { + margin-bottom: 3em; +} + +/* page footer */ + +footer { + margin: 3em 0; +} + +footer .nav { + text-align: center; + margin-top: 5em; + margin-bottom: 3.5em; +} + +footer .nav a { + padding: 0 0.5em; + font-size: 1.2em; + text-decoration: none; +} + +footer .about { + border-top: 1px dashed #d2d2d2; + padding: 2.2em 3em; + font-size: 0.7em; + -webkit-column-count: 3; + -moz-column-count: 3; + -ms-column-count: 3; + column-count: 3; + -webkit-column-gap: 2em; + -moz-column-gap: 2em; + -ms-column-gap: 2em; + column-gap: 2em; +} + +footer .copy { + text-align: center; + font-size: 0.7em; + font-style: italic; + margin-top: 1em; +} + +footer .copy, footer .copy a { + color: #8e8e8e; +} + +/* article */ + +.article { + margin: 3em 0 4em; +} + +.article header { + border-top: 1px dashed #d2d2d2; +} + +.article header h2 { + font-style: italic; + text-align: center; + font-weight: 400; + margin: 0.8em 0; + font-size: 1.4em; +} + +.article header h2 a { + text-decoration: none; +} + +.article header .date { + text-align: center; + font-size: 0.8em; + margin-top: -0.7em; +} + +.article header .date span { + background-color: #f8f8f8; + padding: 0 0.7em; +} + +.article.intro .content p { + display: inline; +} + +.article.intro .content .more { + text-decoration: underline; + font-weight: 700; + padding-left: 0.3em; +} + +.article .content img { + display: block; + width: 100%; +} + +.more, .date { + font-family: 'Merriweather', serif; + font-variant: small-caps; + text-transform: lowercase; + font-weight: 400; + text-rendering: auto; + letter-spacing: 1px; +} + +/* archive */ + +.archive { + width: 32em; + margin: 5em auto 6em; + padding-left: 2em; +} + +.archive h2 { + font-size: 2em; + margin: 0; + margin-left: 6.1em; + margin-bottom: 0.5em; + font-style: italic; +} + +.archive a, .archive span{ + display: block; + float: left; + margin-bottom: -1px; + text-decoration: none; +} +.archive li:not(:last-child) { + border-bottom: 1px solid #d2d2d2; + margin-bottom: -1px; +} + +.archive a.last, .archive span.last { + border: 0; + margin-bottom: 0; +} + +.archive a { + width: 21em; + text-indent: 1em; + white-space: nowrap; +} + +.archive .year-label, +.archive .month-label{ + width: 4em; + font-family: 'Merriweather', serif; + font-variant: small-caps; + text-transform: lowercase; + font-weight: 400; + text-rendering: auto; + letter-spacing: 1px; + text-align: center; +} + +.archive .month-label { + width: 7em; +} + +.archive ul { + list-style: none; + margin: 0; +} + +.archive ul li { + margin: 0; +} + +/* code styling */ + +code { + font-family: 'Anonymous Pro', monospace; + font-size: 0.85em; + color: #000; +} + +pre code { + display: block; + line-height: 1.1; +} + +p code { + padding: 0.1em 0.3em 0.2em; + border-radius: 0.3em; + position: relative; + background: #fffff3; + + white-space: nowrap; +} + +/* syntax hl stuff */ + +code.lang-markdown { + color: #424242; +} + +code.lang-markdown .header, +code.lang-markdown .strong { + font-weight: bold; +} + +code.lang-markdown .emphasis { + font-style: italic; +} + +code.lang-markdown .horizontal_rule, +code.lang-markdown .link_label, +code.lang-markdown .code, +code.lang-markdown .header, +code.lang-markdown .link_url { + color: #555; +} + +code.lang-markdown .blockquote, +code.lang-markdown .bullet { + color: #bbb; +} + +/* Tomorrow Theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ +.tomorrow-comment, pre .comment, pre .title { + color: #8e908c; +} + +.tomorrow-red, pre .variable, pre .attribute, pre .tag, pre .regexp, pre .ruby .constant, pre .xml .tag .title, pre .xml .pi, pre .xml .doctype, pre .html .doctype, pre .css .id, pre .css .class, pre .css .pseudo { + color: #c82829; +} + +.tomorrow-orange, pre .number, pre .preprocessor, pre .built_in, pre .literal, pre .params, pre .constant { + color: #f5871f; +} + +.tomorrow-yellow, pre .class, pre .ruby .class .title, pre .css .rules .attribute { + color: #eab700; +} + +.tomorrow-green, pre .string, pre .value, pre .inheritance, pre .header, pre .ruby .symbol, pre .xml .cdata { + color: #718c00; +} + +.tomorrow-aqua, pre .css .hexcolor { + color: #3e999f; +} + +.tomorrow-blue, pre .function, pre .python .decorator, pre .python .title, pre .ruby .function .title, pre .ruby .title .keyword, pre .perl .sub, pre .javascript .title, pre .coffeescript .title { + color: #4271ae; +} + +.tomorrow-purple, pre .keyword, pre .javascript .function { + color: #8959a8; +} + +/* media queries */ + +@media (min-width: 1600px) { + body { font-size: 26px; } +} + +@media (max-width: 900px) { + body { font-size: 18px; } +} + +@media (max-width: 690px) { + .content-wrap { + width: auto; + padding: 0 1em; + } + .header { + margin: 1em 0; + } + .header h1 { + font-size: 1.4em; + margin-bottom: 0.6em; + } + .header .description { + font-size: 1em; + } + .article { + margin: 1em 0 2.5em; + } + .archive { + width: 80%; + margin: 0 auto; + } + .archive * { + float: none !important; + line-height: 1.6 !important; + width: auto !important; + height: auto !important; + text-align: left !important; + border: 0 !important; + margin: 0 !important; + } + footer .nav { + margin: 1em 0; + } + footer .about { + padding: 0; + font-size: 0.9em; + padding-top: 1.6em; + -webkit-column-count: 1; + -moz-column-count: 1; + -ms-column-count: 1; + column-count: 1; + } + footer .about p { + margin-bottom: 1em; + } +} diff --git a/contents/feed.json b/contents/feed.json new file mode 100644 index 0000000..9c3d3fd --- /dev/null +++ b/contents/feed.json @@ -0,0 +1,4 @@ +{ + "template": "feed.jade", + "filename": "feed.xml" +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..8be80d2 --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "dependencies": { + "clean-css": "^2.2.16", + "moment": "2.3.x", + "typogr": "0.5.x", + "underscore": "1.4.x", + "wintersmith": "~2.1.x" + }, + "repository": "none" +} diff --git a/plugins/paginator.coffee b/plugins/paginator.coffee new file mode 100644 index 0000000..a8ce516 --- /dev/null +++ b/plugins/paginator.coffee @@ -0,0 +1,91 @@ + +module.exports = (env, callback) -> + ### Paginator plugin. Defaults can be overridden in config.json + e.g. "paginator": {"perPage": 10} ### + + defaults = + template: 'index.jade' # template that renders pages + articles: 'articles' # directory containing contents to paginate + first: 'index.html' # filename/url for first page + filename: 'page/%d/index.html' # filename for rest of pages + perPage: 2 # number of articles per page + + # assign defaults any option not set in the config file + options = env.config.paginator or {} + for key, value of defaults + options[key] ?= defaults[key] + + getArticles = (contents) -> + # helper that returns a list of articles found in *contents* + # note that each article is assumed to have its own directory in the articles directory + articles = contents[options.articles]._.directories.map (item) -> item.index + # skip articles that does not have a template associated + articles = articles.filter (item) -> item.template isnt 'none' + # sort article by date + articles.sort (a, b) -> b.date - a.date + return articles + + class PaginatorPage extends env.plugins.Page + ### A page has a number and a list of articles ### + + constructor: (@pageNum, @articles) -> + + getFilename: -> + if @pageNum is 1 + options.first + else + options.filename.replace '%d', @pageNum + + getView: -> (env, locals, contents, templates, callback) -> + # simple view to pass articles and pagenum to the paginator template + # note that this function returns a funciton + + # get the pagination template + template = templates[options.template] + if not template? + return callback new Error "unknown paginator template '#{ options.template }'" + + # setup the template context + ctx = {@articles, @pageNum, @prevPage, @nextPage} + + # extend the template context with the enviroment locals + env.utils.extend ctx, locals + + # finally render the template + template.render ctx, callback + + # register a generator, 'paginator' here is the content group generated content will belong to + # i.e. contents._.paginator + env.registerGenerator 'paginator', (contents, callback) -> + + # find all articles + articles = getArticles contents + + # populate pages + numPages = Math.ceil articles.length / options.perPage + pages = [] + for i in [0...numPages] + pageArticles = articles.slice i * options.perPage, (i + 1) * options.perPage + pages.push new PaginatorPage i + 1, pageArticles + + # add references to prev/next to each page + for page, i in pages + page.prevPage = pages[i - 1] + page.nextPage = pages[i + 1] + + # create the object that will be merged with the content tree (contents) + # do _not_ modify the tree directly inside a generator, consider it read-only + rv = {pages:{}} + for page in pages + rv.pages["#{ page.pageNum }.page"] = page # file extension is arbitrary + rv['index.page'] = pages[0] # alias for first page + rv['last.page'] = pages[(numPages-1)] # alias for last page + + # callback with the generated contents + callback null, rv + + # add the article helper to the environment so we can use it later + env.helpers.getArticles = getArticles + + # tell the plugin manager we are done + callback() diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..6cb2899 --- /dev/null +++ b/readme.md @@ -0,0 +1,4 @@ + +# Blog + +The default [wintersmith](https://github.com/jnordberg/wintersmith) template diff --git a/templates/archive.jade b/templates/archive.jade new file mode 100644 index 0000000..8113b30 --- /dev/null +++ b/templates/archive.jade @@ -0,0 +1,34 @@ + +extends layout +//- this logic should be moved to a view at some point + +block content + - var lineHeight = 2.2; + - var archives = _.chain(env.helpers.getArticles(contents)).groupBy(function(item) { + - return item.date.getFullYear() + - }).value() + - for (var archive in archives) { + - archives[archive] = _.groupBy(archives[archive], function(item){return item.date.getMonth();}) + - } + - var month_names = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] + section.archive + h2 Archive + ul + - var yearsK = _.chain(archives).keys().reverse().value() + - for(var year in yearsK) + - months = archives[yearsK[year]] + - var yearHeight = lineHeight * _.reduce(months, function(memo,month) { return memo + month.length; }, 0); + li + span.year-label(style='line-height:' + yearHeight+'em')=yearsK[year] + ul(style='margin-left:4em') + - var monthsK = _.chain(months).keys().reverse().value() + - for(month in monthsK){ + - var monthHeight = lineHeight * months[monthsK[month]].length + li + span.month-label(style='line-height:'+monthHeight+'em')=month_names[monthsK[month]] + ul(style='margin-left:7em') + each item in months[monthsK[month]] + li(style='height:'+ lineHeight + 'em;line-height:'+ lineHeight + 'em;') + a(href=item.url)=item.title + - } + \ No newline at end of file diff --git a/templates/article.jade b/templates/article.jade new file mode 100644 index 0000000..ddab9db --- /dev/null +++ b/templates/article.jade @@ -0,0 +1,25 @@ + +extends layout + +block append vars + - bodyclass = 'article-detail' + +block prepend title + | #{ page.title + " - "} + +block header + include author + h1= page.title + p.author + | #{ "Written by " } + mixin author(page.metadata.author) + +block content + article.article + section.content!= typogr(page.html).typogrify() + +block prepend footer + div.nav + a(href=contents.index.url) « Full blog + + diff --git a/templates/author.jade b/templates/author.jade new file mode 100644 index 0000000..ab7c9a5 --- /dev/null +++ b/templates/author.jade @@ -0,0 +1,8 @@ + +mixin author(authorName) + - var author = contents.authors[authorName + '.json'] + span.author + if author + a(href=author.metadata.website)= author.metadata.name + else + =authorName diff --git a/templates/feed.jade b/templates/feed.jade new file mode 100644 index 0000000..19f0343 --- /dev/null +++ b/templates/feed.jade @@ -0,0 +1,25 @@ +doctype xml +rss(version='2.0', + xmlns:content='http://purl.org/rss/1.0/modules/content/', + xmlns:wfw='http://wellformedweb.org/CommentAPI/', + xmlns:dc='http://purl.org/dc/elements/1.1/' + xmlns:atom='http://www.w3.org/2005/Atom') + channel + - var articles = env.helpers.getArticles(contents); + title= locals.name + atom:link(href=locals.url + '/feed.xml', rel='self', type='application/rss+xml') + link= locals.url + description= locals.description + pubDate= articles[0].rfc822date + generator Wintersmith - https://github.com/jnordberg/wintersmith + language en + for article in articles + - var permalink = locals.url + article.url + item + title= article.title + link= permalink + pubDate= article.rfc822date + guid(isPermaLink='true')= permalink + author= article.author + //- passing locals.url resolves all relative urls to absolute + description= article.getHtml(locals.url) diff --git a/templates/index.jade b/templates/index.jade new file mode 100644 index 0000000..81aed0c --- /dev/null +++ b/templates/index.jade @@ -0,0 +1,29 @@ +extends layout + +block content + include author + each article in articles + article.article.intro + header + p.date + span= moment.utc(article.date).format('DD. MMMM YYYY') + h2 + a(href=article.url)= article.title + section.content + if article.intro.length > 0 + | !{ typogr(article.intro).typogrify() } + if article.hasMore + p.more + a(href=article.url) more + +block prepend footer + div.nav + if prevPage + a(href=prevPage.url) « Newer + else + a(href='/archive.html') « Archives + if nextPage + a(href=nextPage.url) Next page » + + + diff --git a/templates/layout.jade b/templates/layout.jade new file mode 100644 index 0000000..e4efc1c --- /dev/null +++ b/templates/layout.jade @@ -0,0 +1,36 @@ +doctype html +block vars + - var bodyclass = null; +html(lang='en') + head + block head + meta(charset='utf-8') + meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1') + meta(name='viewport', content='width=device-width') + title + block title + = locals.name + link(rel='alternate', href=locals.url+'/feed.xml', type='application/rss+xml', title=locals.description) + link(rel='stylesheet', href='http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic|Anonymous+Pro:400,700,400italic,700italic|Merriweather:400,700,300') + link(rel='stylesheet', href='/css/main.min.css') + body(class=bodyclass) + header.header + div.content-wrap + block header + div.logo + h1 + a(href=locals.url)= locals.name + p.description= locals.description + div#content + div.content-wrap + block content + h2 Welcome to zombocom! + footer + div.content-wrap + block footer + section.about + !=contents['about.md'].html + section.copy + p © #{ new Date().getFullYear() } #{ locals.owner } — powered by  + a(href='https://github.com/jnordberg/wintersmith') Wintersmith + //- please leave the "powered by" if you use the design