Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jul 7, 2023
1 parent e76998a commit 5116ec4
Show file tree
Hide file tree
Showing 21 changed files with 165 additions and 162 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<!-- deno-fmt-ignore-file -->

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
project adheres to [Semantic Versioning](http://semver.org/).

## [0.8.0] - 2023-07-07
### Changed
- Switch to Vento (from Nunjuks) a the template engine.
- Minimum Lume version supported is 1.18.1.
- Use the feed plugin to generate RSS.

## [0.7.2] - 2023-03-19
### Fixed
- Plugin for table of contents wasn't installed correctly.
Expand Down Expand Up @@ -103,14 +108,15 @@ project adheres to [Semantic Versioning](http://semver.org/).

## [0.1.1] - 2022-09-20
### Fixed
- Pagination in `archive.njk` by @angelside [#1].
- Pagination in `archive.vto` by @angelside [#1].

## [0.1.0] - 2022-06-16
First version

[#1]: https://github.com/lumeland/theme-simple-blog/issues/1
[#5]: https://github.com/lumeland/theme-simple-blog/issues/5

[0.8.0]: https://github.com/lumeland/theme-simple-blog/compare/v0.7.2...v0.8.0
[0.7.2]: https://github.com/lumeland/theme-simple-blog/compare/v0.7.1...v0.7.2
[0.7.1]: https://github.com/lumeland/theme-simple-blog/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/lumeland/theme-simple-blog/compare/v0.6.0...v0.7.0
Expand Down
2 changes: 1 addition & 1 deletion demo/about.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: layouts/page.njk
layout: layouts/page.vto
title: About Me
menu:
visible: true
Expand Down
2 changes: 1 addition & 1 deletion demo/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"imports": {
"lume/": "https://deno.land/x/lume@v1.17.0/"
"lume/": "https://deno.land/x/lume@v1.18.1/"
},
"tasks": {
"lume": "echo \"import 'lume/cli.ts'\" | deno run --unstable -A -",
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"imports": {
"lume/": "https://deno.land/x/lume@v1.17.0/"
"lume/": "https://deno.land/x/lume@v1.18.1/"
},
"tasks": {
"lume": "echo \"import 'lume/cli.ts'\" | deno run --unstable -A -",
Expand Down
16 changes: 8 additions & 8 deletions mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export default function (options: Partial<Options> = {}) {
"_includes/css/badge.css",
"_includes/css/variables.css",
"_includes/css/search.css",
"_includes/layouts/archive_result.njk",
"_includes/layouts/archive.njk",
"_includes/layouts/base.njk",
"_includes/layouts/page.njk",
"_includes/layouts/post.njk",
"_includes/templates/post-details.njk",
"_includes/templates/post-list.njk",
"_includes/layouts/archive_result.vto",
"_includes/layouts/archive.vto",
"_includes/layouts/base.vto",
"_includes/layouts/page.vto",
"_includes/layouts/post.vto",
"_includes/templates/post-details.vto",
"_includes/templates/post-list.vto",
"fonts/inter.woff2",
"fonts/inter-italic.woff2",
"fonts/epilogue-bold.woff2",
Expand All @@ -35,7 +35,7 @@ export default function (options: Partial<Options> = {}) {
"404.md",
"archive_result.tmpl.js",
"archive.tmpl.js",
"index.njk",
"index.vto",
"styles.css",
"favicon.png",
];
Expand Down
2 changes: 2 additions & 0 deletions plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import metas from "lume/plugins/metas.ts";
import pagefind from "lume/plugins/pagefind.ts";
import sitemap from "lume/plugins/sitemap.ts";
import feed from "lume/plugins/feed.ts";
import vento from "lume/plugins/vento.ts";
import readingTime from "https://raw.githubusercontent.com/lumeland/experimental-plugins/main/reading_time/mod.ts";
import toc from "https://deno.land/x/[email protected]/toc.ts";
import image from "https://deno.land/x/[email protected]/image.ts";
Expand All @@ -35,6 +36,7 @@ export default function (options: Options = {}) {
.use(pagefind())
.use(terser())
.use(sitemap())
.use(vento())
.use(feed({
output: ["/feed.xml", "/feed.json"],
query: "type=post",
Expand Down
2 changes: 1 addition & 1 deletion src/404.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: layouts/base.njk
layout: layouts/base.vto
url: /404.html
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: layouts/base.njk
layout: layouts/base.vto
bodyClass: body-tag
---
<header class="page-header">
Expand All @@ -10,47 +10,46 @@ bodyClass: body-tag
<a href="/feed.xml">Atom</a>, <a href="/feed.json">JSON</a>
</p>

{% if pagination.page == 1 %}
{{ if pagination.page === 1 }}
<div class="search" id="search"></div>
{% endif %}
{{ /if }}
</header>

{% if pagination.page == 1 %}
{% set pageTags = search.pages("type=tag", "tag") %}
{% if pageTags.length %}
{{ if pagination.page === 1 }}
{{ set pageTags = search.pages("type=tag", "tag") }}
{{ if pageTags.length }}
<nav class="page-navigation">
<h2>Tags:</h2>

<ul class="page-navigation-tags">
{% for page in pageTags %}
{{ for page of pageTags }}
<li><a href="{{ page.data.url }}" class="badge">{{ page.data.tag }}</a></li>
{% endfor %}
{{ /for }}
</ul>
</nav>
{% endif %}
{% endif %}
{{ /if }}
{{ /if }}

{% set postslist = results %}
{% include "templates/post-list.njk" %}
{{ include "templates/post-list.vto" { postslist: results } }}

{% if pagination.totalPages != 1 %}
{{ if pagination.totalPages !== 1 }}
<nav class="page-pagination pagination">
<ul>
{%- if pagination.previous %}
{{- if pagination.previous }}
<li class="pagination-prev">
<a href="{{ pagination.previous }}" rel="prev">← Previous</a>
</li>
{% endif %}
{{ /if }}

<li class="pagination-page">
Page {{ pagination.page }}
</li>

{%- if pagination.next %}
{{- if pagination.next }}
<li class="pagination-next">
<a href="{{ pagination.next }}" rel="next">Next →</a>
</li>
{% endif %}
{{ /if }}
</ul>
</nav>
{% endif %}
{{ /if }}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
layout: layouts/base.njk
layout: layouts/base.vto
bodyClass: body-tag
---
<header class="page-header">
<p><a href="/archive/">← Back</a></p>
<h1 class="page-title">{{ title }}</h1>
</header>

{% set postslist = search.pages(search_query) %}
{% include "templates/post-list.njk" %}
{{ include "templates/post-list.vto" { postslist: search.pages(search_query) } }}
22 changes: 10 additions & 12 deletions src/_includes/layouts/base.njk → src/_includes/layouts/base.vto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title or metas.title }} - {{ metas.site }}</title>
<title>{{ it.title || metas.title }} - {{ metas.site }}</title>

<meta name="supported-color-schemes" content="light dark">
<meta name="theme-color" content="hsl(220, 20%, 100%)" media="(prefers-color-scheme: light)">
Expand All @@ -14,9 +14,7 @@
<link rel="alternate" href="/feed.xml" type="application/atom+xml" title="{{ metas.site }}">
<link rel="alternate" href="/feed.json" type="application/json" title="{{ metas.site }}">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.png">
{% if extra_head %}
{{ extra_head | safe }}
{% endif %}
{{ it.extra_head || "" }}
</head>
<body>
<nav class="navbar">
Expand All @@ -25,25 +23,25 @@
</a>

<ul class="navbar-links">
{%- for entry in search.pages("menu.visible=true", "menu.order") %}
{{- for entry of search.pages("menu.visible=true", "menu.order") }}
<li>
<a href="{{ entry.data.url }}"{% if entry.data.url == url %} aria-current="page"{% endif %}>
{{ entry.data.menu.title or entry.data.title }}
<a href="{{ entry.data.url }}"{{ if entry.data.url == url }} aria-current="page"{{ /if }}>
{{ entry.data.menu.title || entry.data.title }}
</a>
</li>
{%- endfor %}
{%- for link in menu_links %}
{{ /for }}
{{- for link of it.menu_links }}
<li>
<a href="{{ link.href }}">
{{ link.text }}
</a>
</li>
{%- endfor %}
{{ /for }}
</ul>
</nav>

<main class="{{ bodyClass }}">
{{ content | safe }}
<main class="{{ it.bodyClass }}">
{{ content }}
</main>

<!-- Current page: {{ url }} -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
layout: layouts/base.njk
layout: layouts/base.vto
bodyClass: body-tag
---
<article class="post" data-pagefind-body>
<header class="post-header">
<h1 class="post-title">{{ title }}</h1>
<h1 class="post-title">{{ it.title }}</h1>

{{ subtitle | md | safe }}
{{ it.subtitle |> md }}
</header>

<div class="post-body">
{{ content | safe }}
{{ content }}
</div>
</article>
34 changes: 17 additions & 17 deletions src/_includes/layouts/post.njk → src/_includes/layouts/post.vto
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
---
layout: layouts/base.njk
layout: layouts/base.vto
bodyClass: body-post
---
<article class="post" data-pagefind-body data-title="{{ title }}" data-pagefind-index-attrs="data-title">
<header class="post-header">
<h1 class="post-title">{{ title }}</h1>

{% include "templates/post-details.njk" %}
{{ include "templates/post-details.vto" }}
</header>

{% if toc.length > 1 or toc[0].children.length %}
{{ if toc.length > 1 || toc[0].children.length }}
<nav class="toc">
<h2>Table of contents</h2>
<ol>
{% for item in toc %}
{{ for item of toc }}
<li>
<a href="#{{ item.slug }}">{{ item.text }}</a>

{% if item.children.length %}
{{ if item.children.length }}
<ul>
{% for child in item.children %}
{{ for child of item.children }}
<li>
<a href="#{{ child.slug }}">{{ child.text }}</a>
</li>
{% endfor %}
{{ /for }}
</ul>
{% endif %}
{{ /if }}
</li>
{% endfor %}
{{ /for }}
</ol>
</nav>
{% endif %}
{{ /if }}

<div class="post-body body">
{{ content | safe }}
{{ content }}
</div>
</article>

<nav class="page-pagination pagination">
<ul>
{%- set previousPost = search.previousPage(url, "type=post") %}
{%- if previousPost %}
{{- set previousPost = search.previousPage(url, "type=post") }}
{{- if previousPost }}
<li class="pagination-prev">
<a href="{{ previousPost.data.url }}" rel="prev">
<span>← Older post</span>
<strong>{{ previousPost.data.title }}</strong>
</a>
</li>
{% endif %}
{{ /if }}

{%- set nextPost = search.nextPage(url, "type=post") %}
{%- if nextPost %}
{{- set nextPost = search.nextPage(url, "type=post") }}
{{- if nextPost }}
<li class="pagination-next">
<a href="{{ nextPost.data.url }}" rel="next">
<span>Newer post →</span>
<strong>{{ nextPost.data.title }}</strong>
</a>
</li>
{% endif %}
{{ /if }}
</ul>
</nav>
28 changes: 0 additions & 28 deletions src/_includes/templates/post-details.njk

This file was deleted.

Loading

0 comments on commit 5116ec4

Please sign in to comment.