Skip to content

Commit

Permalink
Redesign personal webiste
Browse files Browse the repository at this point in the history
  • Loading branch information
davidojedalopez committed Sep 11, 2021
1 parent 151d267 commit 8a301d4
Show file tree
Hide file tree
Showing 180 changed files with 399 additions and 9,714 deletions.
110 changes: 110 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
const { DateTime, Settings } = require("luxon");
const fs = require("fs");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const readingTime = require('eleventy-plugin-reading-time');
const path = require("path");

Settings.defaultLocale = 'en-US';


module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(readingTime);

eleventyConfig.setDataDeepMerge(true);

eleventyConfig.addFilter("readableDate", dateObj => {
if (dateObj instanceof String) {
dateObj = new Date(dateObj);
}
return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat("dd LLLL yyyy");
});

eleventyConfig.addFilter("toISOString", dateObj => {
if (dateObj instanceof String) {
dateObj = new Date(dateObj)
}
return dateObj.toISOString();
});

eleventyConfig.addFilter("getTime", dateObj => {
if (dateObj instanceof String) {
dateObj = new Date(dateObj)
}
return dateObj.getTime();
});

// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter('htmlDateString', dateObj => {
return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat('yyyy-LL-dd');
});

eleventyConfig.addFilter('slugDate', dateObj => {
return DateTime.fromJSDate(dateObj, { zone: 'utc' }).toFormat('yyyy/LL/dd');
})

// Get the first `n` elements of a collection.
eleventyConfig.addFilter("head", (array, n) => {
if (n < 0) {
return array.slice(n);
}

return array.slice(0, n);
});

// Filter source file names using a glob

eleventyConfig.addPassthroughCopy("img");
eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addPassthroughCopy('robots.txt')
eleventyConfig.addPassthroughCopy('humans.txt')
eleventyConfig.addPassthroughCopy('manifest.json')
eleventyConfig.addPassthroughCopy('.well-known')

// Browsersync Overrides
eleventyConfig.setBrowserSyncConfig({
callbacks: {
ready: function (err, browserSync) {
// browserSync.addMiddleware("*", (req, res) => {
// const content_404 = fs.readFileSync('_site/404.html'));
// res.writeHead(404, { "ContentType": "text/html; charset=UTF-8" })
// res.write(content_404);
// res.end();
// });
},
},
ui: false,
ghostMode: false
});

return {
templateFormats: [
"md",
"njk",
"html",
"liquid"
],

// If your site lives in a different subdirectory, change this.
// Leading or trailing slashes are all normalized away, so don’t worry about those.

// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
// This is only used for link URLs (it does not affect your file structure)
// Best paired with the `url` filter: https://www.11ty.io/docs/filters/url/

// You can also pass this in on the command line using `--pathprefix`
// pathPrefix: "/",

markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dataTemplateEngine: "njk",

// These are all optional, defaults are shown:
dir: {
input: ".",
includes: "_includes",
data: "_data",
output: "_site"
}
};
};
2 changes: 2 additions & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
_11ty/
13 changes: 11 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
_site/
.idea/
.DS_store
node_modules/
package-lock.json
credentials.json
.env
token.json
.DS_Store

# Local Netlify folder
.netlify

.idea/*
9 changes: 0 additions & 9 deletions .vscode/settings.json

This file was deleted.

1 change: 0 additions & 1 deletion CNAME

This file was deleted.

3 changes: 0 additions & 3 deletions Gemfile

This file was deleted.

249 changes: 0 additions & 249 deletions Gemfile.lock

This file was deleted.

0 comments on commit 8a301d4

Please sign in to comment.