mirror of
https://github.com/ckaczor/Blog.git
synced 2026-01-14 01:25:37 -05:00
Initial commit from template
This commit is contained in:
69
_includes/layouts/base.njk
Normal file
69
_includes/layouts/base.njk
Normal file
@@ -0,0 +1,69 @@
|
||||
<!doctype html>
|
||||
<html lang="{{ metadata.language }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ title or metadata.title }}</title>
|
||||
<meta name="description" content="{{ description or metadata.description }}">
|
||||
<link rel="alternate" href="feed/feed.xml" type="application/atom+xml" title="{{ metadata.title }}">
|
||||
|
||||
{#- Uncomment this if you’d like folks to know that you used Eleventy to build your site! #}
|
||||
{#- <meta name="generator" content="{{ eleventy.generator }}"> #}
|
||||
|
||||
{#-
|
||||
Plain-text bundles are provided via the `eleventy-plugin-bundle` plugin:
|
||||
1. CSS:
|
||||
* Add to a per-page bundle using `{% css %}{% endcss %}`
|
||||
* Retrieve bundle content using `{% getBundle "css" %}` or `{% getBundleFileUrl "css" %}`
|
||||
2. Or for JavaScript:
|
||||
* Add to a per-page bundle using `{% js %}{% endjs %}`
|
||||
* Retrieve via `{% getBundle "js" %}` or `{% getBundleFileUrl "js" %}`
|
||||
3. Learn more: https://github.com/11ty/eleventy-plugin-bundle
|
||||
#}
|
||||
|
||||
{#- Add an arbitrary string to the bundle #}
|
||||
{%- css %}/* This is an arbitrary CSS string added to the bundle */{% endcss %}
|
||||
{#- Add the contents of a file to the bundle #}
|
||||
{%- css %}{% include "public/css/index.css" %}{% endcss %}
|
||||
{#- Or you can add from node_modules #}
|
||||
{# {%- css %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %} #}
|
||||
|
||||
{#- Render the CSS bundle using inlined CSS (for the fastest site performance in production) #}
|
||||
<style>{% getBundle "css" %}</style>
|
||||
{#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #}
|
||||
{#- <link rel="stylesheet" href="{% getBundleFileUrl "css" %}"> #}
|
||||
|
||||
{#- Add the heading-anchors web component to the JavaScript bundle #}
|
||||
{%- js %}{% include "node_modules/@zachleat/heading-anchors/heading-anchors.js" %}{% endjs %}
|
||||
</head>
|
||||
<body>
|
||||
<a href="#skip" class="visually-hidden">Skip to main content</a>
|
||||
|
||||
<header>
|
||||
<a href="/" class="home-link">{{ metadata.title }}</a>
|
||||
|
||||
{#- Read more about `eleventy-navigation` at https://www.11ty.dev/docs/plugins/navigation/ #}
|
||||
<nav>
|
||||
<h2 class="visually-hidden">Top level navigation menu</h2>
|
||||
<ul class="nav">
|
||||
{%- for entry in collections.all | eleventyNavigation %}
|
||||
<li class="nav-item"><a href="{{ entry.url }}"{% if entry.url == page.url %} aria-current="page"{% endif %}>{{ entry.title }}</a></li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main id="skip">
|
||||
<heading-anchors>
|
||||
{{ content | safe }}
|
||||
</heading-anchors>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p><em>Built with <a href="https://www.11ty.dev/">{{ eleventy.generator }}</a></em></p>
|
||||
</footer>
|
||||
|
||||
<!-- This page `{{ page.url | htmlBaseUrl }}` was built on {% currentBuildDate %} -->
|
||||
<script type="module" src="{% getBundleFileUrl "js" %}"></script>
|
||||
</body>
|
||||
</html>
|
||||
16
_includes/layouts/home.njk
Normal file
16
_includes/layouts/home.njk
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
layout: layouts/base.njk
|
||||
---
|
||||
<!-- Delete this block, which will also remove the component CSS from the bundle -->
|
||||
{%- css %}{% include "public/css/message-box.css" %}{% endcss %}
|
||||
<div class="message-box">
|
||||
<ol>
|
||||
<li>Edit <code>_data/metadata.js</code> with your blog’s information.</li>
|
||||
<li>(Optional) Edit <code>eleventy.config.js</code> with your <a href="https://www.11ty.dev/docs/config/">configuration preferences</a>.</li>
|
||||
<li>Delete this message from <code>_includes/layouts/home.njk</code>.</li>
|
||||
</ol>
|
||||
<p><em>This is an <a href="https://www.11ty.dev/">Eleventy project</a> created from the <a href="https://github.com/11ty/eleventy-base-blog"><code>eleventy-base-blog</code> repo</a>.</em></p>
|
||||
</div>
|
||||
<!-- Stop deleting -->
|
||||
|
||||
{{ content | safe }}
|
||||
28
_includes/layouts/post.njk
Normal file
28
_includes/layouts/post.njk
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
layout: layouts/base.njk
|
||||
---
|
||||
{# Only include the syntax highlighter CSS on blog posts, included with the CSS per-page bundle #}
|
||||
{%- css %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %}
|
||||
{%- css %}{% include "public/css/prism-diff.css" %}{%- endcss %}
|
||||
<h1>{{ title }}</h1>
|
||||
|
||||
<ul class="post-metadata">
|
||||
<li><time datetime="{{ page.date | htmlDateString }}">{{ page.date | readableDate }}</time></li>
|
||||
{%- for tag in tags | filterTagList %}
|
||||
{%- set tagUrl %}/tags/{{ tag | slugify }}/{% endset %}
|
||||
<li><a href="{{ tagUrl }}" class="post-tag">{{ tag }}</a>{%- if not loop.last %}, {% endif %}</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
|
||||
{{ content | safe }}
|
||||
|
||||
{%- if collections.posts %}
|
||||
{%- set previousPost = collections.posts | getPreviousCollectionItem %}
|
||||
{%- set nextPost = collections.posts | getNextCollectionItem %}
|
||||
{%- if nextPost or previousPost %}
|
||||
<ul class="links-nextprev">
|
||||
{%- if previousPost %}<li class="links-nextprev-prev">← Previous<br> <a href="{{ previousPost.url }}">{{ previousPost.data.title }}</a></li>{% endif %}
|
||||
{%- if nextPost %}<li class="links-nextprev-next">Next →<br><a href="{{ nextPost.url }}">{{ nextPost.data.title }}</a></li>{% endif %}
|
||||
</ul>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
9
_includes/postslist.njk
Normal file
9
_includes/postslist.njk
Normal file
@@ -0,0 +1,9 @@
|
||||
{%- css %}.postlist { counter-reset: start-from {{ (postslistCounter or postslist.length) + 1 }} }{% endcss %}
|
||||
<ol reversed class="postlist">
|
||||
{% for post in postslist | reverse %}
|
||||
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}">
|
||||
<a href="{{ post.url }}" class="postlist-link">{% if post.data.title %}{{ post.data.title }}{% else %}<code>{{ post.url }}</code>{% endif %}</a>
|
||||
<time class="postlist-date" datetime="{{ post.date | htmlDateString }}">{{ post.date | readableDate("LLLL yyyy") }}</time>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
Reference in New Issue
Block a user