Skip to content

Commit

Permalink
Split the date archives into year/month grouping.
Browse files Browse the repository at this point in the history
Tweaked the posts template.
Reworked some content.
  • Loading branch information
leekelleher committed Mar 19, 2016
1 parent 3924a63 commit d027497
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 55 deletions.
19 changes: 10 additions & 9 deletions config.wyam
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,23 @@ Pipelines.Add("Posts",
Pipelines.Add("Archives",
ReadFiles("archive.cshtml"),
Execute(@ctx.Documents
.Where(x => x.ContainsKey("date"))
.ContainsKey("date")
.SelectMany(x => {
var items = new[]{ "yyyy", "yyyy/MM", "yyyy/MM/dd" };
return items.Select(d => new
{
DateFormat = d,
DateValue = x.Get<DateTime>("date").ToString(d)
DateValue = x.Get<DateTime>("date").ToString(d),
DateTitle = x.Get<DateTime>("date").ToString(string.Join(" ", d.Split('/').Reverse()).Replace("MM", "MMMM"))
}
);
})
.Distinct()
.Select(x => @ctx.GetDocument(@doc, new Dictionary<string, object>()
{
{ "ArchiveDateFormat", x.DateFormat },
{ "ArchiveDate", x.DateValue }
{ "ArchiveDate", x.DateValue },
{ "title", "Archive for " + x.DateTitle }
})
)
),
Expand All @@ -52,15 +54,15 @@ Pipelines.Add("Tags",
.Distinct()
.Select(x => @ctx.GetDocument(@doc, new Dictionary<string, object>()
{
{ "Title", x },
{ "Tag", x.ToLowerInvariant().Replace(' ', '-') }
{ "title", x },
{ "tag", x.ToLowerInvariant().Replace(' ', '-') }
})
)
),
CopyMeta("Tag", "canonical", "/tag/{0}/"),
CopyMeta("tag", "canonical", "/tag/{0}/"),
Razor()
.WithViewStart("_layouts/_ViewStart.cshtml"),
WriteFiles("./tag/" + @doc.String("Tag") + "/index.html")
WriteFiles("./tag/" + @doc.String("tag") + "/index.html")
);

Pipelines.Add("Pages",
Expand All @@ -87,7 +89,7 @@ Pipelines.Add("Feeds",
OrderBy(@doc.Get<DateTime>("date"))
.Descending(true),
Rss(siteRoot: "http://leekelleher.com",
outputRssFilePath: "feed.xml",
outputRssFilePath: "feed/index.xml",
feedTitle: "Lee Kelleher",
feedDescription: "Umbraco Specialist"
)
Expand All @@ -96,7 +98,6 @@ Pipelines.Add("Feeds",
.WithPublicationDateMetaKey("date")
.AssumePermalinks()
.WithLinkCustomizer(x => x.Replace("/index.html", "/")),
Meta("canonical", "feed.xml"),
WriteFiles()
);

Expand Down
13 changes: 6 additions & 7 deletions input/_layouts/_layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>leekelleher.com</title>
<title>@(Model.ContainsKey("title") ? Model.String("title") + " | " : "")Lee Kelleher - Umbraco Specialist</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="description" content="The personal website of Lee Kelleher; Umbraco specialist">
Expand All @@ -13,10 +13,9 @@
</head>
<body>
<header>
<h1><a href="/">Lee Kelleher</a></h1>
<h1><a href="/" rel="home">Lee Kelleher</a></h1>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/about/">About</a></li>
<li><a href="/tag/umbraco/">Umbraco</a></li>
<li><a href="/contact/">Contact</a></li>
Expand All @@ -26,7 +25,7 @@
<main>
<aside>
<hr>
<blockquote>Wondering why you don't see any CSS on this page? <b>Don't worry, it's not broken.</b> <a href="/back-to-basics/">Read all about the reasons behind it here</a>.</blockquote>
<blockquote>What happened to the design? <b>Don't worry, it's not broken.</b> <a href="/2016/03/back-to-basics/">Read about why styles are disabled on my website</a>.</blockquote>
<hr>
</aside>
@RenderBody()
Expand All @@ -42,9 +41,9 @@
</ul>
</nav>
</div>
<div id="copyright">
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_GB" title="All content is licensed under Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License"><img alt="Creative Commons Licence" src="http://i.creativecommons.org/l/by-nc-nd/3.0/80x15.png"></a></p>
<p>Copyright &copy; 2006-@DateTime.UtcNow.Year <a href="https://plus.google.com/101191195603583215493?rel=author" rel="author">Lee Kelleher</a></p>
<div>
<p><small><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/deed.en_GB">All content is licensed under Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License</a></small></p>
<p><span rel="copyright">Copyright &copy; 2006-@DateTime.UtcNow.Year</span> <a href="https://plus.google.com/101191195603583215493?rel=author" rel="author">Lee Kelleher</a></p>
</div>
</footer>
</body>
Expand Down
48 changes: 40 additions & 8 deletions input/_layouts/archive.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,52 @@
var archiveDate = Model.String("ArchiveDate");

var posts = Documents
.ContainsKey("date")
.Where(x => x.Get<DateTime>("date").ToString(dateFormat) == archiveDate);

var displayFormat = string.Join(" ", dateFormat.Split('/').Reverse()).Replace("MM", "MMMM");
var heading = posts.First().Get<DateTime>("date").ToString(displayFormat);
.ContainsKey("date");

ViewData["PostListDocuments"] = posts
var archivePosts = posts
.Where(x => x.Get<DateTime>("date").ToString(dateFormat) == archiveDate)
.OrderBy(x => x.Get<DateTime>("date"));

var years = posts
.Select(x => x.Get<DateTime>("date").Year)
.Distinct()
.OrderByDescending(x => x);
}

<section>
<header>
<h2>Blog archive by date</h2>
<h3>@heading</h3>
</header>
@Html.Partial(@"_layouts\postListing")
<ul>
@foreach (var year in archivePosts.GroupBy(x => x.Get<DateTime>("date").Year))
{
<li>
<h3>@year.Key</h3>
<ul>
@foreach (var month in year.GroupBy(x => x.Get<DateTime>("date").ToString("MMMM")))
{
ViewData["PostListDocuments"] = month;
<li>
<h4>@month.Key</h4>
@Html.Partial(@"_layouts\postListing")
</li>
}
</ul>
</li>
}
</ul>
</section>

<section>
<header>
<h2>Year Archive</h2>
</header>
<ul>
@foreach (var year in years)
{
<li>
<a href="/@year/">@year</a>
</li>
}
</ul>
</section>
5 changes: 3 additions & 2 deletions input/_layouts/post.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
<header>
<h1>@Model["title"]</h1>
<p><span>Posted on <time datetime="@date.ToString("yyyy-MM-ddTHH:mm")">@date.ToShortDateString()</time></span></p>
<p><span>Tags:</span> @getTags(Model)</p>
</header>

<article>
@RenderBody()
</article>
<div>
<p><span>Tags:</span> @getTags(Model)</p>
</div>
</section>
12 changes: 8 additions & 4 deletions input/_layouts/postListing.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@
var date = post.Get<DateTime>("date");

<li>
<div>
<h4><a href="@post["permalink"]" rel="bookmark">@post["title"]</a></h4>
<p><span>Posted on <time datetime="@date.ToString("yyyy-MM-ddTHH:mm")">@date.ToShortDateString()</time></span></p>
<h4><a href="@post["permalink"]" rel="bookmark">@post["title"]</a></h4>
<p><span>Posted on <time datetime="@date.ToString("yyyy-MM-ddTHH:mm")">@date.ToShortDateString()</time></span></p>
@if (post.ContainsKey("Excerpt"))
{
<p>@Html.Raw(post["Excerpt"])</p>
}
@if (post.ContainsKey("tags"))
{
<p><span>Tags:</span> @getTags(post)</p>
</div>
}
</li>
}
</ul>
2 changes: 1 addition & 1 deletion input/_layouts/tags.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.ContainsKey("tags")
.ToLookup<string>("tags");

var tag = Model.String("Title");
var tag = Model.String("title");

ViewData["PostListDocuments"] = documentsByTag[tag]
.OrderByDescending(x => x.Get<DateTime>("date"));
Expand Down
23 changes: 0 additions & 23 deletions input/_pages/back-to-basics.md

This file was deleted.

37 changes: 37 additions & 0 deletions input/_posts/2016-03-back-to-basics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Back to basics
date: 2016-03-19T12:47:00+00:00
layout: post
permalink: /2016/03/back-to-basics/
tags:
- HTML
- CSS
---

## TL;DR;

> **Is this site broken?**
>
> No. I decided to try an experiment with letting my website go CSS naked. It's an attempt for me to make proper use of Web Standards, HTML5, semantic markup and hierarchical structure.

## My reasoning

When I decided to reboot my website, I started to spend time browsing themes and designs, while I found many decent ones, there wasn't any that I felt comfortable with. I didn't have much interest in designing my own - using the latest CSS framework, with a dozen dependencies. I was getting bogged down with the style/presentation.

I wanted to bring my focus back to content; _I wanted to take back my website!_

I decided to leave the CSS out of it, forget about JavaScript and web-fonts, let's focus on using HTML, pure and simple, structural and semantic. The added bonus is that my website would be accessible, responsive, lightweight and fast!

Will this look pretty? No! Default browser styles suck - at least that's what we're told. Although I'm sure that people who visit my website aren't looking for a good design, they should want the content, so now I can present it in the most accessible way.


### What will the future hold?

In time I may introduce some styling, tweak the viewport width or apply a reasonable typography, but for now I'd like to focus on the semantics of the markup - to lay a solid foundation to build on.

As for JavaScript, previously I would automatically add in Google Analytics, but truth be told, I hardly study my traffic or data these days. It doesn't motivate me.

I'm likely to reintroduce the Disqus commenting system very soon.

In the meantime, if you have any questions for me, either [tweet me](https://twitter.com/leekelleher) or [raise an issue on my GitHub repo for this website](https://github.com/leekelleher/leekelleher.com/issues).
2 changes: 1 addition & 1 deletion input/index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<section>
<header>
<h2>Archive</h2>
<h2>Year Archive</h2>
</header>
<ul>
@foreach (var year in years)
Expand Down

0 comments on commit d027497

Please sign in to comment.