Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Commit

Permalink
Migrate to 11ty (#11)
Browse files Browse the repository at this point in the history
* Migrate to 11ty

* fixed site
  • Loading branch information
jarjan committed Jan 30, 2020
1 parent 9bffa7b commit 2632e45
Show file tree
Hide file tree
Showing 57 changed files with 7,163 additions and 559 deletions.
52 changes: 52 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const { DateTime, Settings } = require("luxon");
const util = require("util");

Settings.defaultLocale = "ru";

module.exports = function(eleventyConfig) {
// Layout aliases for convenience
eleventyConfig.addLayoutAlias("default", "layouts/base.njk");
eleventyConfig.addLayoutAlias("conf", "layouts/conf.njk");

// a debug utility
eleventyConfig.addFilter("dump", obj => {
return util.inspect(obj);
});

eleventyConfig.addFilter("htmlDate", dateObj => {
return DateTime.fromJSDate(dateObj, {
zone: "utc"
}).toFormat("y-MM-dd");
});

// Grab excerpts and sections from a file
eleventyConfig.addFilter("section", require("./src/utils/section.js"));

// compress and combine js files
eleventyConfig.addFilter("jsmin", require("./src/utils/minify-js.js"));

// minify the html output when running in prod
if (process.env.NODE_ENV == "production") {
eleventyConfig.addTransform(
"htmlmin",
require("./src/utils/minify-html.js")
);
}

// Static assets to pass through
eleventyConfig.addPassthroughCopy("./src/site/fonts");
eleventyConfig.addPassthroughCopy("./src/site/images");
eleventyConfig.addPassthroughCopy("./src/site/css");

return {
dir: {
input: "src/site",
includes: "_includes",
output: "dist"
},
passthroughFileCopy: true,
templateFormats: ["njk", "md"],
htmlTemplateEngine: "njk",
markdownTemplateEngine: "njk"
};
};
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# dependecies installed by npm
/node_modules

# build artefacts
/dist
/src/site/css

# secrets
.env

# other
.DS_Store
.vscode
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

> Blog of @jarjan about life in Berlin, Germany. (In russian)
[jjermany.blog](https://jjermany.blog) is created using [Hugo](https://gohugo.io/) and lives on [Netlify](http://netlify.com).
[jjermany.blog](https://jjermany.blog) is created using [11ty](https://11ty.dev/) and lives on [Netlify](http://netlify.com).
6 changes: 0 additions & 6 deletions archetypes/default.md

This file was deleted.

20 changes: 0 additions & 20 deletions config.toml

This file was deleted.

60 changes: 27 additions & 33 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,35 @@
[build]
command = "npm run build"
publish = "dist"
# functions = "./src/functions"

[context.production]
environment = { NODE_VERSION = "10.15.3", NODE_ENV = "production" }

[dev]
command = "npm run start"
publish = "dist"
port = 3000
targetPort = 8181
NODE_ENV = "development"
# functionsPort = 34567

[[redirects]]
from = "http://jjermany.netlify.com/*"
to = "http://jjermany.blog/:splat"
status = 301
force = true
from = "/post/*"
to = "/blog/:splat"

[[redirects]]
from = "/post/"
to = "/"
status = 301

[build]
publish = "public"
command = "hugo --gc --minify"

[context.production.environment]
HUGO_VERSION = "0.54.0"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"

[context.split1]
command = "hugo --gc --minify --enableGitInfo"

[context.split1.environment]
HUGO_VERSION = "0.54.0"
HUGO_ENV = "production"

[context.deploy-preview]
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"

[context.deploy-preview.environment]
HUGO_VERSION = "0.54.0"

[context.branch-deploy]
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"

[context.branch-deploy.environment]
HUGO_VERSION = "0.54.0"
[[redirects]]
from = "/blog/"
to = "/"
status = 301

[context.next.environment]
HUGO_ENABLEGITINFO = "true"
[[redirects]]
from = "http://jjermany.netlify.com/*"
to = "http://jjermany.blog/:splat"
status = 301
force = true
Loading

0 comments on commit 2632e45

Please sign in to comment.