Skip to content

Commit 2d26ed5

Browse files
feat: use fernfolio theme
1 parent 255aacc commit 2d26ed5

File tree

189 files changed

+5408
-5051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+5408
-5051
lines changed

.eleventy.js

Lines changed: 100 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,120 @@
1-
const rssPlugin = require('@11ty/eleventy-plugin-rss');
2-
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
3-
const fs = require('fs');
4-
5-
const pluginTOC = require('eleventy-plugin-toc')
6-
7-
8-
const filters = require('./src/11ty/filters');
9-
const filtersMethods = Object.entries(filters);
10-
11-
// Import transforms
12-
const parseTransform = require('./src/11ty/transforms/parse-transform.js');
13-
14-
const markdownConfig = require('./src/11ty/utils/markdown.js');
15-
16-
// Import data files
17-
const site = require('./src/_data/site.json');
18-
19-
const passthroughItems = [
20-
"src/_redirects",
21-
"src/fonts",
22-
"src/images",
23-
"src/js",
24-
"src/css",
25-
"src/uploads",
26-
"node_modules/nunjucks/browser/nunjucks-slim.js"
27-
]
28-
29-
module.exports = function (config) {
30-
// Filters
31-
filtersMethods.forEach(([name, filter]) => {
32-
config.addFilter(name, filter)
1+
const { DateTime } = require("luxon");
2+
const CleanCSS = require("clean-css");
3+
const UglifyJS = require("uglify-es");
4+
const htmlmin = require("html-minifier");
5+
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
6+
const slugify = require('slugify');
7+
8+
module.exports = function(eleventyConfig) {
9+
10+
// Eleventy Navigation https://www.11ty.dev/docs/plugins/navigation/
11+
eleventyConfig.addPlugin(eleventyNavigationPlugin);
12+
13+
// Configuration API: use eleventyConfig.addLayoutAlias(from, to) to add
14+
// layout aliases! Say you have a bunch of existing content using
15+
// layout: post. If you don’t want to rewrite all of those values, just map
16+
// post to a new file like this:
17+
// eleventyConfig.addLayoutAlias("post", "layouts/my_new_post_layout.njk");
18+
19+
// Merge data instead of overriding
20+
// https://www.11ty.dev/docs/data-deep-merge/
21+
eleventyConfig.setDataDeepMerge(true);
22+
23+
// Add support for maintenance-free post authors
24+
// Adds an authors collection using the author key in our post frontmatter
25+
// Thanks to @pdehaan: https://github.com/pdehaan
26+
eleventyConfig.addCollection("authors", collection => {
27+
const blogs = collection.getFilteredByGlob("src/posts/*.md");
28+
return blogs.reduce((coll, post) => {
29+
const author = slugify(post.data.author);
30+
if (!author) {
31+
return coll;
32+
}
33+
if (!coll.hasOwnProperty(author)) {
34+
coll[author] = [];
35+
}
36+
coll[author].push(post.data);
37+
return coll;
38+
}, {});
3339
});
3440

35-
// Transforms
36-
config.addTransform('parse', parseTransform);
37-
38-
passthroughItems.forEach(item => {
39-
config.addPassthroughCopy(item);
40-
})
41+
// Date formatting (human readable)
42+
eleventyConfig.addFilter("readableDate", dateObj => {
43+
return DateTime.fromJSDate(dateObj).toFormat("dd/MM/yyyy");
44+
});
4145

42-
config.addCollection('posts', collection => {
43-
return [
44-
...collection.getFilteredByGlob('./src/posts/*.md')
45-
].reverse();
46+
// Date formatting (machine readable)
47+
eleventyConfig.addFilter("machineDate", dateObj => {
48+
return DateTime.fromJSDate(dateObj).toFormat("yyyy-MM-dd");
4649
});
4750

48-
config.addCollection('work', collection => {
49-
return collection.getFilteredByGlob('./src/work/*.md')
50-
.sort((a, b) => b.data.start - a.data.start);
51+
// Minify CSS
52+
eleventyConfig.addFilter("cssmin", function(code) {
53+
return new CleanCSS({}).minify(code).styles;
5154
});
5255

53-
// Plugins
54-
config.addPlugin(rssPlugin);
55-
config.addPlugin(syntaxHighlight);
56-
config.addPlugin(pluginTOC, {
57-
tags: ['h2', 'h3', 'h4'],
58-
wrapper: 'nav',
59-
wrapperClass: 'toc'
56+
// Minify JS
57+
eleventyConfig.addFilter("jsmin", function(code) {
58+
let minified = UglifyJS.minify(code);
59+
if (minified.error) {
60+
console.log("UglifyJS error: ", minified.error);
61+
return code;
62+
}
63+
return minified.code;
6064
});
6165

62-
// 404
63-
config.setBrowserSyncConfig({
64-
ui: false,
65-
// Replicate click on all opened tabs
66-
ghostMode: false,
67-
callbacks: {
68-
ready: function (err, browserSync) {
69-
const content_404 = fs.readFileSync('dist/404.html');
70-
71-
browserSync.addMiddleware('*', (req, res) => {
72-
// Provides the 404 content without redirect.
73-
res.write(content_404);
74-
res.end();
75-
});
76-
}
66+
// Minify HTML output
67+
eleventyConfig.addTransform("htmlmin", function(content, outputPath) {
68+
if (outputPath && outputPath.indexOf(".html") > -1) {
69+
let minified = htmlmin.minify(content, {
70+
useShortDoctype: true,
71+
removeComments: true,
72+
collapseWhitespace: true
73+
});
74+
return minified;
7775
}
76+
return content;
7877
});
7978

80-
config.setLibrary("md", markdownConfig)
79+
// Don't process folders with static assets e.g. images
80+
eleventyConfig.addPassthroughCopy("src/favicon.ico");
81+
eleventyConfig.addPassthroughCopy("src/static/img");
82+
eleventyConfig.addPassthroughCopy("src/admin");
83+
eleventyConfig.addPassthroughCopy("src/_includes/assets/");
84+
85+
/* Markdown Plugins */
86+
let markdownIt = require("markdown-it");
87+
let markdownItAnchor = require("markdown-it-anchor");
88+
let options = {
89+
html: true,
90+
breaks: true,
91+
linkify: true
92+
};
93+
let opts = {
94+
permalink: false
95+
};
8196

82-
config.setFrontMatterParsingOptions({
83-
excerpt: true,
84-
excerpt_separator: "---"
85-
});
97+
eleventyConfig.setLibrary("md", markdownIt(options)
98+
.use(markdownItAnchor, opts)
99+
);
86100

87101
return {
88-
templateFormats: [
89-
"md",
90-
"njk",
91-
],
92-
markdownTemplateEngine: "njk",
102+
templateFormats: ["md", "njk", "html", "liquid"],
103+
104+
// If your site lives in a different subdirectory, change this.
105+
// Leading or trailing slashes are all normalized away, so don’t worry about it.
106+
// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
107+
// This is only used for URLs (it does not affect your file structure)
108+
pathPrefix: "/",
109+
110+
markdownTemplateEngine: "liquid",
93111
htmlTemplateEngine: "njk",
94112
dataTemplateEngine: "njk",
95113
dir: {
96-
input: 'src',
97-
output: 'dist'
98-
},
99-
passthroughFileCopy: true
114+
input: "src",
115+
includes: "_includes",
116+
data: "_data",
117+
output: "dist"
118+
}
100119
};
101120
};

.eleventyignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
README.md
2+
.github/

.gitignore

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
*.log
2-
npm-debug.*
3-
*.scssc
4-
*.log
5-
*.swp
6-
.DS_Store
7-
.sass-cache
8-
node_modules
9-
dist
10-
11-
# Specifics
12-
13-
# Hide design tokens
14-
src/scss/_tokens.scss
15-
16-
# Hide compiled CSS
17-
src/_includes/assets/*
1+
_site/
2+
node_modules/
3+
package-lock.json

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Sylvain METAYER
3+
Copyright (c) 2021 Tyler M. Roderick
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,79 @@
1-
# Personal Website
1+
[![Netlify Status](https://api.netlify.com/api/v1/badges/5702ba89-7242-490e-b04d-e4a691faced5/deploy-status)](https://app.netlify.com/sites/fernfolio/deploys)
22

3-
[![Depfu](https://badges.depfu.com/badges/7a567e824b66dfa3193846d89c9b8e59/overview.svg)](https://depfu.com/github/sylvainmetayer/site?project_id=14116)
4-
![Github Eleventy Build](https://github.com/sylvainmetayer/site/workflows/Eleventy%20Build/badge.svg)
5-
[![Netlify Status](https://api.netlify.com/api/v1/badges/eea326e0-9c5d-443f-a0e5-ba949add331a/deploy-status)](https://app.netlify.com/sites/wizardly-aryabhata-f4e800/deploys)
3+
# Fernfolio
4+
The super simple portfolio template built with [Eleventy](https://www.11ty.io/) and [Netlify CMS](https://www.netlifycms.org/)
65

7-
> Sylvain METAYER
8-
>
9-
> Inspired from [Hylia theme](https://github.com/hankchizljaw/hylia) and others
6+
<img width="1280" alt="fernfolio screenshot" src="https://raw.githubusercontent.com/TylerMRoderick/fernfolio-11ty-template/master/fernfolio-preview.png">
107

11-
## Setup
8+
### <pre>🖥 [Demo](https://fernfolio.netlify.app/)</pre>
129

13-
- `npm ci`
10+
## 🤔 What is this?
11+
An [Eleventy](https://www.11ty.io/) theme designed to simplify the process of deploying a beautiful portfolio and blog. Launch your site in minutes!
1412

15-
- `npm start`
13+
Based on the [eleventy-netlify-boilerplate](https://github.com/danurbanowicz/eleventy-netlify-boilerplate), but modified to perfectly fit the needs of a modern technical porfolio.
1614

17-
## Build
15+
## ✨ Features
16+
* Built in support for [Netlify CMS](https://www.netlifycms.org/) with editor previews
17+
* Customizable blog and project pages with tag support
18+
* Working contact form powered by [Netlify Forms](https://www.netlify.com/products/forms/)
19+
* Super fast page render and high lighthouse scores
20+
* Uses Markdown for content files and Nunjucks for layouts
21+
* 100% Javascript framework free
22+
* Continuous Deployment workflow via [Netlify](https://www.netlify.com/)
23+
* Base styles powered by [Sakura](https://github.com/oxalorg/sakura) classless css framework
24+
* Vanilla css for custom styles (keep it simple)
1825

19-
- `npm run build`
26+
27+
## 🚀 Quick Start
28+
29+
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/TylerMRoderick/fernfolio-11ty-template&stack=cms)
30+
31+
### 1. Click the "Deploy to Netlify" button above
32+
This will clone this repo to your github account and will deploy a copy of the demo website to your Netlify
33+
account (you can create an account during this process if you don't have one)
34+
35+
### 2. Setup authentication
36+
37+
After deploying this project, Netlify Identity will add you as a CMS user and
38+
will email you an invite. Hit the "Accept the invite" link and this should take you to the deployed site. From there, you can add your password to finish user setup.
39+
40+
### 3. Edit some content
41+
Now that you are added as a CMS user, add `/admin` to the end of your site url, and log in using your new credentials. You should now see the content editor interface. Now you can start editing content! Any changes to your new repo will auto-deploy a new version to netflify. Cool huh?
42+
43+
### 4. Setup local environment
44+
- Clone the repo locally `git clone https://github.com/TylerMRoderick/fernfolio-11ty-template.git`
45+
- Navigate to root folder `cd your-site`
46+
- Install the goods `npm install`
47+
- Run it `npm start`
48+
- You should now be able to see everything running on localhost:8080
49+
- Add some changes (view [theme customizations](https://fernfolio.netlify.app/posts/theme-customizations/) for some options)
50+
- Push your changes to github and an auto-deploy should be triggered
51+
52+
## 💻 Development Scripts
53+
54+
**`npm start`**
55+
56+
> Run 11ty with hot reload at localhost:8080
57+
58+
**`npm run build`**
59+
60+
> Generate minified production build
61+
62+
Use this as the "Publish command" if needed by hosting such as Netlify.
63+
64+
Checkout the Eleventy [Command Line Usage docs](https://www.11ty.dev/docs/usage/) for more options
65+
66+
67+
## 🎩 Common issues
68+
69+
If you change the repo that was created at deploy time from public to private, you'll need to regenerate your token,
70+
as the token generated using the deploy to Netlify button can only access public repositories. To
71+
regenerate your token, head to "Settings" in your Netlify site dashboard, go to the "Identity"
72+
section, then scroll to "Services" where you'll see an "Edit settings" button. Click that and you'll
73+
see a text link to "Generate access token in GitHub".
74+
75+
If you need any help with setting up Netlify CMS, you can reach out to the Netlify team in the [Netlify CMS Gitter](https://gitter.im/netlify/netlifycms).
76+
77+
## Bug reports, feature requests, etc
78+
79+
This is an ongoing project and I welcome contributions and suggestions! Feel free to submit a PR or issue.

0 commit comments

Comments
 (0)