Start migrating layout and root files to the new generator

This commit is contained in:
Sami Samhuri 2019-12-01 16:02:32 -08:00
parent 5c47b83da6
commit 89c2d37f16
7 changed files with 162 additions and 153 deletions

View file

@ -1,152 +0,0 @@
<!doctype html>
<html lang="en">
<!-- meow -->
<% allScripts = [] -%>
<% allStyles = [] -%>
<% var ctx = public -%>
<% var n = current.path.length -%>
<% for (var i in current.path) { -%>
<% var path = current.path[i] -%>
<% if (ctx._data) { -%>
<% if (ctx._data.scripts || ctx._data._scripts) { -%>
<% allScripts = allScripts.concat(ctx._data.scripts || ctx._data._scripts) -%>
<% } -%>
<% if (ctx._data.styles || ctx._data._styles) { -%>
<% allStyles = allStyles.concat(ctx._data.styles || ctx._data._styles) -%>
<% } -%>
<% if (ctx._data[path] && ctx._data[path].scripts) { -%>
<% allScripts = allScripts.concat(ctx._data[path].scripts) -%>
<% } -%>
<% if (ctx._data[path] && ctx._data[path].styles) { -%>
<% allStyles = allStyles.concat(ctx._data[path].styles) -%>
<% } -%>
<% } -%>
<% ctx = ctx[path] -%>
<% } -%>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<% if (typeof title != 'undefined') { -%>
<title><%= site %>: <%= title %></title>
<% } else { -%>
<title><%= site %></title>
<% } -%>
<link rel="icon" type="image/png" href="/images/favicon-32x32.png">
<link rel="shortcut icon" href="/images/favicon.ico">
<link rel="apple-touch-icon" href="/images/apple-touch-icon.png">
<link rel="mask-icon" href="/images/safari-pinned-tab.svg" color="#aa0000">
<link rel="manifest" href="/images/manifest.json">
<meta name="msapplication-config" content="/images/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<% for (var i in allStyles) { -%>
<link rel="stylesheet" href="<%= allStyles[i] %>">
<% } -%>
<link rel="author" type="text/plain" href="/humans.txt">
<link rel="alternate" type="application/rss+xml" href="<%= url %>/feed.xml" title="<%= site %>">
<link rel="alternate" type="application/json" href="<%= url %>/feed.json" title="<%= site %>">
<link rel="dns-prefetch" href="https://gist.github.com">
<link rel="dns-prefetch" href="https://use.typekit.net">
<script src="https://use.typekit.net/tcm1whv.js" integrity="sha384-Cajpx1SH5pZw/OSd5LTP9EBy6XLNv0Ti69o0b2bzYF6Zb8/P/Qy3BSbZpYZiUg0Q" crossorigin="anonymous"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>
<script>
if (typeof console === 'undefined') {
console = { log: function() {} }
}
window.SJS = {
ready: function(fn) {
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', fn, false)
} else if (window.attachEvent) {
window.attachEvent('onload', fn)
}
}
}
</script>
</head>
<% var bodyClasses = current.path -%>
<body class="<%= bodyClasses.join(' ') %>">
<header class="primary">
<div class="title">
<h1><a href="/"><%= site %></a></h1>
<br>
<h4>By <a href="/about"><%= author %></a></h4>
</div>
<nav>
<ul>
<li><a href="/about">About</a></li>
<li><a href="/archive">Archive</a></li>
<li><a href="/projects">Projects</a></li>
<li class="twitter"><a href="https://twitter.com/_sjs"><i class="fa fa-twitter"></i></a></li>
<li class="github"><a href="https://github.com/samsonjs"><i class="fa fa-github"></i></a></li>
<li class="email"><a href="mailto:sami@samhuri.net"><i class="fa fa-envelope"></i></a></li>
<li class="rss"><a href="/feed.xml"><i class="fa fa-rss"></i></a></li>
</ul>
</nav>
<div class="clearfix"></div>
</header>
<% if (typeof link != 'undefined' && link !== null) { -%>
<article class="container">
<header>
<h2><a href="<%= link %>">&rarr; <%= title %></a></h2>
<time><%= date %></time>
<a class="permalink" href="<%= url %>">&infin;</a>
</header>
<%- yield %>
</article>
<div class="row clearfix">
<p class="fin clearfix"><i class="fa fa-code"></i></p>
</div>
<% } else if (typeof date != 'undefined' && date !== null) { -%>
<article class="container">
<header>
<h2><a href="<%= url %>"><%= title %></a></h2>
<time><%= date %></time>
</header>
<%- yield %>
</article>
<div class="row clearfix">
<p class="fin"><i class="fa fa-code"></i></p>
</div>
<% } else if (typeof title != 'undefined' && title !== null) { -%>
<article class="container">
<h2><%= title %></h2>
<%- yield %>
</article>
<div class="row clearfix">
<p class="fin"><i class="fa fa-code"></i></p>
</div>
<% } else { -%>
<%- yield %>
<% } -%>
<footer class="container">
&copy; 2006 - <%= new Date().getFullYear() %> <a href="/about"><%= author %></a>
</footer>
<script type="text/javascript">
(function() {
var css = document.createElement('link');
css.href = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css';
css.rel = 'stylesheet';
css.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(css);
})();
</script>
<% for (var i in allScripts) { -%>
<script defer src="<%= allScripts[i] %>"></script>
<% } -%>
</body>
</html>

View file

@ -0,0 +1,34 @@
HANDLED {% if post.link %} -%>
<article class="container">
<header>
<h2><a href="<%= post.link %>">&rarr; <%= post.title %></a></h2>
<time><%= post.date %></time>
<a class="permalink" href="<%= post.url %>">&infin;</a>
</header>
<%- yield %>
</article>
<div class="row clearfix">
<p class="fin clearfix"><i class="fa fa-code"></i></p>
</div>
HANDLED <% } else if (typeof date != 'undefined' && date !== null) { -%>
<article class="container">
<header>
<h2><a href="<%= url %>"><%= title %></a></h2>
<time><%= date %></time>
</header>
<%- yield %>
</article>
<div class="row clearfix">
<p class="fin"><i class="fa fa-code"></i></p>
</div>
WTF IS THIS?? <% } else if (typeof title != 'undefined' && title !== null) { -%>
<article class="container">
<h2><%= title %></h2>
<%- yield %>
</article>
<div class="row clearfix">
<p class="fin"><i class="fa fa-code"></i></p>
</div>
HANDLED <% } else { -%>
<%- yield %>
<% } -%>

14
templates/post-link.html Normal file
View file

@ -0,0 +1,14 @@
{% extends "samhuri.net.html" %}
{% block body %}
<article class="container">
<header>
<h2><a href="{{ post.link }}">&rarr; {{ post.title }}</a></h2>
<time>{{ post.date }}</time>
<a class="permalink" href="{{ post.url }}">&infin;</a>
</header>
{{ post.body }}
</article>
<div class="row clearfix">
<p class="fin clearfix"><i class="fa fa-code"></i></p>
</div>
{% endblock %}

13
templates/post-text.html Normal file
View file

@ -0,0 +1,13 @@
{% extends "samhuri.net.html" %}
{% block body %}
<article class="container">
<header>
<h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
<time>{{ post.date }}</time>
</header>
{{ post.body }}
</article>
<div class="row clearfix">
<p class="fin"><i class="fa fa-code"></i></p>
</div>
{% endblock %}

View file

@ -1,3 +1,5 @@
{% extends "samhuri.net.html" %}
{% block body %}
<div class="container">
<% var posts = public._data.posts -%>
<% for (var i in posts) { -%>
@ -32,4 +34,5 @@
</div>
<% } -%>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,95 @@
<!doctype html>
<html lang="en">
<!-- meow -->
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
{% if post %}
<title>{{ site.title }}: {{ post.title }}</title>
{% else %}
<title>{{ site.title }}</title>
{% endif %}
<link rel="icon" type="image/png" href="/images/favicon-32x32.png">
<link rel="shortcut icon" href="/images/favicon.ico">
<link rel="apple-touch-icon" href="/images/apple-touch-icon.png">
<link rel="mask-icon" href="/images/safari-pinned-tab.svg" color="#aa0000">
<link rel="manifest" href="/images/manifest.json">
<meta name="msapplication-config" content="/images/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
{% for style in styles %}
<link rel="stylesheet" href="{{ style }}">
{% endfor %}
<link rel="author" type="text/plain" href="/humans.txt">
<link rel="alternate" type="application/rss+xml" href="{{ site.url }}/feed.xml" title="{{ site.title }}">
<link rel="alternate" type="application/json" href="{{ site.url }}/feed.json" title="{{ site.title }}">
<link rel="dns-prefetch" href="https://gist.github.com">
<link rel="dns-prefetch" href="https://use.typekit.net">
<script src="https://use.typekit.net/tcm1whv.js" integrity="sha384-Cajpx1SH5pZw/OSd5LTP9EBy6XLNv0Ti69o0b2bzYF6Zb8/P/Qy3BSbZpYZiUg0Q" crossorigin="anonymous"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>
<script>
if (typeof console === 'undefined') {
console = { log: function() {} }
}
window.SJS = {
ready: function(fn) {
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', fn, false)
} else if (window.attachEvent) {
window.attachEvent('onload', fn)
}
}
}
</script>
</head>
<body class="{{ bodyClassNames }}">
<header class="primary">
<div class="title">
<h1><a href="/">{{ site.title }}</a></h1>
<br>
<h4>By <a href="/about">{{ site.author }}</a></h4>
</div>
<nav>
<ul>
<li><a href="/about">About</a></li>
<li><a href="/archive">Archive</a></li>
<li><a href="/projects">Projects</a></li>
<li class="twitter"><a href="https://twitter.com/_sjs"><i class="fa fa-twitter"></i></a></li>
<li class="github"><a href="https://github.com/samsonjs"><i class="fa fa-github"></i></a></li>
<li class="email"><a href="mailto:sami@samhuri.net"><i class="fa fa-envelope"></i></a></li>
<li class="rss"><a href="/feed.xml"><i class="fa fa-rss"></i></a></li>
</ul>
</nav>
<div class="clearfix"></div>
</header>
{% block body %}footage not found{% endblock %}
<footer class="container">
&copy; 2006 - {{ currentYear }} <a href="/about">{{ site.author }}</a>
</footer>
<script type="text/javascript">
(function() {
var css = document.createElement('link');
css.href = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css';
css.rel = 'stylesheet';
css.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(css);
})();
</script>
{% for script in scripts %}
<script defer src="{{ script }}"></script>
{% endfor %}
</body>
</html>

2
templates/site.html Normal file
View file

@ -0,0 +1,2 @@
{% extends "samhuri.net.html" %}
{% block body %}{{ body }}{% endblock %}