diff --git a/_includes/disqus-comments.html b/_includes/disqus-comments.html new file mode 100644 index 0000000..07d8a9c --- /dev/null +++ b/_includes/disqus-comments.html @@ -0,0 +1,20 @@ +{%- if page.comments != false and jekyll.environment == "production" -%} + + <div id="disqus_thread"></div> + <script> + var disqus_config = function () { + this.page.url = '{{ page.url | absolute_url }}'; + this.page.identifier = '{{ page.url | absolute_url }}'; + }; + + (function() { + var d = document, s = d.createElement('script'); + + s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js'; + + s.setAttribute('data-timestamp', +new Date()); + (d.head || d.body).appendChild(s); + })(); + </script> + <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript> +{%- endif -%} \ No newline at end of file diff --git a/_includes/google-analytics.html b/_includes/google-analytics.html new file mode 100644 index 0000000..8d5c45e --- /dev/null +++ b/_includes/google-analytics.html @@ -0,0 +1,10 @@ +<script> +if(!(window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1")) { + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); + ga('create', '{{ site.google_analytics }}', 'auto'); + ga('send', 'pageview'); +} +</script> \ No newline at end of file diff --git a/_layouts/default.html b/_layouts/default.html index fcc79e8..d2ade3b 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,15 +1,19 @@ <!DOCTYPE html> -<html> +<html lang="{{ page.lang | default: site.lang | default: "en" }}"> <head> <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> - <meta name="viewport" content="width=device-width"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>{{ site.title }} — {{ page.title }}</title> + <title>{{ site.title }}{% if page.title %} — {{ page.title }}{% endif %}</title> <link rel="stylesheet" href="{{ '/assets/css/main.css' | absolute_url }}?{{ site.time | date: '%s%N' }}"> + {%- if jekyll.environment == 'production' and site.google_analytics -%} + {%- include google-analytics.html -%} + {%- endif -%} + </head> <body> diff --git a/_layouts/home.html b/_layouts/home.html index 3a7b091..b26b5dd 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -30,7 +30,7 @@ layout: default {% endif %} </header> -<main class="home"> +<main class="home" aria-label="Content"> <h1 class="divided"> Contents diff --git a/_layouts/page.html b/_layouts/page.html index 5e71126..99d6bf4 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -1,5 +1,5 @@ --- -layout: default +layout: post --- {{ content }} diff --git a/_layouts/post.html b/_layouts/post.html index ff3c893..046657e 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -6,17 +6,25 @@ layout: default ❮ Home </a> -<article> +<article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting"> - <h1 class="post-title divided"> + <h1 class="post-title divided p-name" itemprop="name headline"> {{ page.title }} </h1> - {{ content }} - - <div class="article-meta"> - <div>{{ page.author }}</div> - <div class="post-date">{{ page.date | date: "%B %-d, %Y" }}</div> + <div class="post-content e-content" itemprop="articleBody"> + {{ content }} </div> + <div class="post-meta"> + {% if page.author %} + <div itemprop="author">{{ page.author }}</div> + {% endif %} + <time class="post-date dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%B %-d, %Y" }}</time> + </div> + + {% if site.disqus.shortname %} + {% include disqus-comments.html %} + {% endif %} + </article> diff --git a/_sass/_article.scss b/_sass/_article.scss index 34cd9fa..9cd7992 100644 --- a/_sass/_article.scss +++ b/_sass/_article.scss @@ -8,13 +8,13 @@ article > * { article > h1 { font-size: 2em; max-width: 48rem; - padding: 2em 0; + padding: 2em 1em; text-align: center; } article p { text-align: justify; - text-indent: 1.5em; + text-indent: 1.5rem; text-justify: inter-word; } @@ -32,11 +32,11 @@ article img { } article li { - margin-left: 1.5em; - margin-right: 1.5em; + margin-left: 1.5rem; + margin-right: 1.5rem; } -.article-meta { +.post-meta { margin-bottom: 2em; margin-top: 2em; text-align: right; diff --git a/_sass/_masthead.scss b/_sass/_masthead.scss index b90c413..39c3e62 100644 --- a/_sass/_masthead.scss +++ b/_sass/_masthead.scss @@ -2,7 +2,7 @@ background: $brand-color; box-sizing: border-box; min-height: 100vh; - padding: 2em; + padding: 6em 2em; position: relative; display: flex; diff --git a/_sass/_syntax-highlighting.scss b/_sass/_syntax-highlighting.scss new file mode 100644 index 0000000..ba4b84e --- /dev/null +++ b/_sass/_syntax-highlighting.scss @@ -0,0 +1,84 @@ +/** + * Syntax highlighting styles + */ + +code.highlighter-rouge { + background: #eef; + font-family: courier, monospace; + font-size: .875em; +} + +.highlight { + background: #fff; + font-family: courier, monospace; + font-size: .875em; + margin: 2rem auto; + + > * { + padding: 0 1.5rem; + } + + .highlighter-rouge & { + background: #eef; + } + + .c { color: #998; font-style: italic } // Comment + .err { color: #a61717; background-color: #e3d2d2 } // Error + .k { font-weight: bold } // Keyword + .o { font-weight: bold } // Operator + .cm { color: #998; font-style: italic } // Comment.Multiline + .cp { color: #999; font-weight: bold } // Comment.Preproc + .c1 { color: #998; font-style: italic } // Comment.Single + .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special + .gd { color: #000; background-color: #fdd } // Generic.Deleted + .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific + .ge { font-style: italic } // Generic.Emph + .gr { color: #a00 } // Generic.Error + .gh { color: #999 } // Generic.Heading + .gi { color: #000; background-color: #dfd } // Generic.Inserted + .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific + .go { color: #888 } // Generic.Output + .gp { color: #555 } // Generic.Prompt + .gs { font-weight: bold } // Generic.Strong + .gu { color: #aaa } // Generic.Subheading + .gt { color: #a00 } // Generic.Traceback + .kc { font-weight: bold } // Keyword.Constant + .kd { font-weight: bold } // Keyword.Declaration + .kp { font-weight: bold } // Keyword.Pseudo + .kr { font-weight: bold } // Keyword.Reserved + .kt { color: #458; font-weight: bold } // Keyword.Type + .m { color: #099 } // Literal.Number + .s { color: #d14 } // Literal.String + .na { color: #008080 } // Name.Attribute + .nb { color: #0086B3 } // Name.Builtin + .nc { color: #458; font-weight: bold } // Name.Class + .no { color: #008080 } // Name.Constant + .ni { color: #800080 } // Name.Entity + .ne { color: #900; font-weight: bold } // Name.Exception + .nf { color: #900; font-weight: bold } // Name.Function + .nn { color: #555 } // Name.Namespace + .nt { color: #000080 } // Name.Tag + .nv { color: #008080 } // Name.Variable + .ow { font-weight: bold } // Operator.Word + .w { color: #bbb } // Text.Whitespace + .mf { color: #099 } // Literal.Number.Float + .mh { color: #099 } // Literal.Number.Hex + .mi { color: #099 } // Literal.Number.Integer + .mo { color: #099 } // Literal.Number.Oct + .sb { color: #d14 } // Literal.String.Backtick + .sc { color: #d14 } // Literal.String.Char + .sd { color: #d14 } // Literal.String.Doc + .s2 { color: #d14 } // Literal.String.Double + .se { color: #d14 } // Literal.String.Escape + .sh { color: #d14 } // Literal.String.Heredoc + .si { color: #d14 } // Literal.String.Interpol + .sx { color: #d14 } // Literal.String.Other + .sr { color: #009926 } // Literal.String.Regex + .s1 { color: #d14 } // Literal.String.Single + .ss { color: #990073 } // Literal.String.Symbol + .bp { color: #999 } // Name.Builtin.Pseudo + .vc { color: #008080 } // Name.Variable.Class + .vg { color: #008080 } // Name.Variable.Global + .vi { color: #008080 } // Name.Variable.Instance + .il { color: #099 } // Literal.Number.Integer.Long +} \ No newline at end of file diff --git a/assets/css/main.scss b/assets/css/main.scss index 52dd5d4..c24f98e 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -8,6 +8,7 @@ $asset_url: '{{ '/assets' | absolute_url }}'; @import "reset", "variables", + "syntax-highlighting", "mixins", "font", "base", diff --git a/hitchens.gemspec b/hitchens.gemspec index e82b8ea..6597dd8 100644 --- a/hitchens.gemspec +++ b/hitchens.gemspec @@ -6,7 +6,7 @@ Gem::Specification.new do |spec| spec.authors = ["Pat Dryburgh"] spec.email = ["hello@patdryburgh.com"] - spec.summary = "An arguably beautiful theme for Jekyll." + spec.summary = "An inarguably well-designed theme for Jekyll." spec.homepage = "http://patdryburgh.com/hitchens" spec.license = "MIT"