Skip to content

Commit 509c271

Browse files
theme customization
bump 11ty to 1.0
1 parent 2d26ed5 commit 509c271

File tree

193 files changed

+3335
-4523
lines changed

Some content is hidden

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

193 files changed

+3335
-4523
lines changed
File renamed without changes.

.eleventy.js

Lines changed: 60 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,75 @@
1-
const { DateTime } = require("luxon");
2-
const CleanCSS = require("clean-css");
3-
const UglifyJS = require("uglify-es");
4-
const htmlmin = require("html-minifier");
51
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-
}, {});
39-
});
2+
const eleventyDartSassPlugin = require("eleventy-plugin-dart-sass");
3+
const path = require('path');
4+
5+
const helpers = require('./src/_data/helpers');
6+
const markdownConfig = require('./src/11ty/utils/markdown');
7+
const browserSyncConfig = require('./src/11ty/utils/browsersync');
8+
const UserConfig = require("@11ty/eleventy/src/UserConfig");
9+
10+
const filters = require('./src/11ty/filters');
11+
const filtersMethods = Object.entries(filters);
12+
13+
const transforms = require('./src/11ty/transforms');
14+
const transformsMethods = Object.entries(transforms);
15+
16+
const sassConfig = {
17+
includePaths: ["**/*.{scss,sass}", "!node_modules/**"],
18+
sassIndexFile: 'main.scss',
19+
watchSass: true,
20+
sassLocation: path.normalize(
21+
path.join(__dirname, "src/_includes/assets/scss/")
22+
),
23+
outDir: path.normalize(
24+
path.join(__dirname, 'dist/')
25+
),
26+
outPath: "/assets/css/",
27+
domainName: helpers.url(),
28+
outFileName: 'main.css',
29+
outputStyle: 'compressed'
30+
};
4031

41-
// Date formatting (human readable)
42-
eleventyConfig.addFilter("readableDate", dateObj => {
43-
return DateTime.fromJSDate(dateObj).toFormat("dd/MM/yyyy");
32+
const passthroughItems = [
33+
'src/_redirects',
34+
{
35+
"src/favicon.ico": "/favicon.ico",
36+
"src/static/img": "/static/img",
37+
"src/static/CV.pdf": "/static/CV.pdf",
38+
"src/_includes/assets/css": "/assets/css",
39+
"src/_includes/assets/js": "/assets/js"
40+
}
41+
];
42+
43+
/** @param {UserConfig} eleventyConfig */
44+
module.exports = function (eleventyConfig) {
45+
filtersMethods.forEach(([name, filter]) => {
46+
eleventyConfig.addFilter(name, filter)
4447
});
4548

46-
// Date formatting (machine readable)
47-
eleventyConfig.addFilter("machineDate", dateObj => {
48-
return DateTime.fromJSDate(dateObj).toFormat("yyyy-MM-dd");
49+
transformsMethods.forEach(([name, filter]) => {
50+
eleventyConfig.addTransform(name, filter)
4951
});
5052

51-
// Minify CSS
52-
eleventyConfig.addFilter("cssmin", function(code) {
53-
return new CleanCSS({}).minify(code).styles;
54-
});
53+
eleventyConfig.addPlugin(eleventyNavigationPlugin);
54+
eleventyConfig.addPlugin(eleventyDartSassPlugin, sassConfig);
5555

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;
64-
});
56+
passthroughItems.forEach(item => {
57+
eleventyConfig.addPassthroughCopy(item);
58+
})
6559

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;
75-
}
76-
return content;
60+
eleventyConfig.setBrowserSyncConfig(browserSyncConfig);
61+
eleventyConfig.setLibrary("md", markdownConfig);
62+
eleventyConfig.setDataDeepMerge(true);
63+
eleventyConfig.setFrontMatterParsingOptions({
64+
excerpt: true,
65+
excerpt_separator: "---"
7766
});
7867

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-
};
96-
97-
eleventyConfig.setLibrary("md", markdownIt(options)
98-
.use(markdownItAnchor, opts)
99-
);
100-
10168
return {
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)
69+
templateFormats: ["md", "njk", "html"],
10870
pathPrefix: "/",
109-
110-
markdownTemplateEngine: "liquid",
71+
passthroughFileCopy: true,
72+
markdownTemplateEngine: "njk",
11173
htmlTemplateEngine: "njk",
11274
dataTemplateEngine: "njk",
11375
dir: {

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
_site/
1+
*.log
2+
npm-debug.*
3+
*.scssc
4+
*.log
5+
*.swp
6+
.DS_Store
7+
.sass-cache
28
node_modules/
3-
package-lock.json
9+
dist/
File renamed without changes.
File renamed without changes.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10
1+
16

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) 2021 Tyler M. Roderick
3+
Copyright (c) 2018 Sylvain METAYER
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: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,19 @@
1-
[![Netlify Status](https://api.netlify.com/api/v1/badges/5702ba89-7242-490e-b04d-e4a691faced5/deploy-status)](https://app.netlify.com/sites/fernfolio/deploys)
1+
# Personal Website
22

3-
# Fernfolio
4-
The super simple portfolio template built with [Eleventy](https://www.11ty.io/) and [Netlify CMS](https://www.netlifycms.org/)
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)
56

6-
<img width="1280" alt="fernfolio screenshot" src="https://raw.githubusercontent.com/TylerMRoderick/fernfolio-11ty-template/master/fernfolio-preview.png">
7+
> Sylvain METAYER
8+
>
9+
> Theme from [Fernfolio](https://github.com/TylerMRoderick/fernfolio-11ty-template)
710
8-
### <pre>🖥 [Demo](https://fernfolio.netlify.app/)</pre>
11+
## Setup
912

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!
13+
- `npm ci`
1214

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.
15+
- `npm start`
1416

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)
17+
## Build
2518

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.
19+
- `npm run build`

netlify.toml

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,57 @@
11
[build]
2-
publish = "_site"
3-
command = "eleventy"
4-
5-
# REDIRECT and HEADERS examples
6-
7-
# Redirect rule example
8-
# For more information see:- https://www.netlify.com/docs/netlify-toml-reference/
9-
10-
#[[redirects]]
11-
# from = "/*"
12-
# to = "/blog/:splat"
13-
14-
# The default HTTP status code is 301, but you can define a different one e.g.
15-
# status = 302
16-
17-
# Headers rule example
18-
# For more information see:- https://www.netlify.com/docs/netlify-toml-reference/
19-
20-
#[[headers]]
21-
# Define which paths this specific [[headers]] block will cover.
22-
# for = "/*"
23-
24-
#[headers.values]
25-
# X-Frame-Options = "DENY"
26-
# X-XSS-Protection = "1; mode=block"
27-
# Content-Security-Policy = "frame-ancestors https://www.facebook.com"
28-
29-
# Redirects and headers are GLOBAL for all builds – they do not get scoped to
30-
# contexts no matter where you define them in the file.
31-
# For context-specific rules, use _headers or _redirects files, which are
32-
# applied on a PER-DEPLOY basis.
2+
command = "npm run build"
3+
ignore = "git log -1 --pretty=%B | grep depfu"
4+
publish = "dist"
5+
6+
[context.production]
7+
environment = {ELEVENTY_ENV = "production"}
8+
9+
[context.deploy-preview]
10+
environment = {ELEVENTY_ENV = "preview"}
11+
12+
[context.branch-deploy]
13+
environment = {ELEVENTY_ENV = "branch"}
14+
15+
[[headers]]
16+
for = "/*"
17+
18+
[headers.values]
19+
Access-Control-Allow-Origin = 'null'
20+
# TODO
21+
Content-Security-Policy = ""
22+
Referrer-Policy = "no-referrer-when-downgrade"
23+
Strict-Transport-Security = "max-age=63072000; includeSubDomains; preload"
24+
X-Content-Type-Options = "nosniff"
25+
X-Frame-Options = "DENY"
26+
X-UA-Compatible = "IE=edge,chrome=1"
27+
X-XSS-Protection = "1; mode=block"
28+
29+
[[plugins]]
30+
package = "netlify-plugin-submit-sitemap"
31+
32+
[plugins.inputs]
33+
baseUrl = "https://sylvain.dev"
34+
providers = ["google", "bing"]
35+
sitemapPath = "/sitemap.xml"
36+
37+
[[plugins]]
38+
package = "netlify-plugin-no-more-404"
39+
40+
[plugins.inputs]
41+
cacheKey = "theme-skip2"
42+
debugMode = false
43+
on404 = "warn"
44+
45+
[[plugins]]
46+
package = "netlify-plugin-checklinks"
47+
48+
[plugins.inputs]
49+
entryPoints = [
50+
"*.html",
51+
]
52+
recursive = true
53+
pretty = true
54+
skipPatterns = []
55+
todoPatterns = []
56+
checkExternal = false
57+
followSourceMaps = false

0 commit comments

Comments
 (0)