convert to ESM, update
This commit is contained in:
parent
9c45f782ba
commit
38270f4f22
3 changed files with 133 additions and 140 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
const EleventyFetch = require('@11ty/eleventy-fetch');
|
import EleventyFetch from '@11ty/eleventy-fetch';
|
||||||
|
|
||||||
module.exports = async function () {
|
export default async function () {
|
||||||
let url = 'https://api.github.com/users/madrilene/repos';
|
let url = 'https://api.github.com/users/madrilene/repos';
|
||||||
|
|
||||||
// returning promise
|
// returning promise
|
||||||
|
|
@ -11,4 +11,4 @@ module.exports = async function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,50 +1,46 @@
|
||||||
module.exports = {
|
/**
|
||||||
/**
|
* Returns back some attributes based on whether the
|
||||||
* Returns back some attributes based on whether the
|
* link is active or a parent of an active item.
|
||||||
* link is active or a parent of an active item.
|
*
|
||||||
*
|
* @param {String} itemUrl - The link in question.
|
||||||
* @param {String} itemUrl - The link in question.
|
* @param {String} pageUrl - The page context.
|
||||||
* @param {String} pageUrl - The page context.
|
* @returns {String} - The attributes or empty.
|
||||||
* @returns {String} - The attributes or empty.
|
*/
|
||||||
*/
|
export function getLinkActiveState(itemUrl, pageUrl) {
|
||||||
|
let response = '';
|
||||||
|
|
||||||
getLinkActiveState(itemUrl, pageUrl) {
|
if (itemUrl === pageUrl) {
|
||||||
let response = '';
|
response = ' aria-current="page"';
|
||||||
|
|
||||||
if (itemUrl === pageUrl) {
|
|
||||||
response = ' aria-current="page"';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (itemUrl.length > 1 && pageUrl.indexOf(itemUrl.replace('/page-0/', '')) === 0) {
|
|
||||||
response += 'data-state="active"';
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Take an array of keys and return back items that match.
|
|
||||||
* Note: items in the collection must have a key attribute in
|
|
||||||
* Front Matter.
|
|
||||||
*
|
|
||||||
* @param {Array} collection - 11ty collection.
|
|
||||||
* @param {Array} keys - Collection of keys.
|
|
||||||
* @returns {Array} - Result collection or empty.
|
|
||||||
*/
|
|
||||||
filterCollectionByKeys(collection, keys) {
|
|
||||||
return collection.filter(x => keys.includes(x.data.key));
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a random UUID (Universally Unique Identifier).
|
|
||||||
*
|
|
||||||
* @returns {string} A random UUID.
|
|
||||||
*/
|
|
||||||
|
|
||||||
random() {
|
|
||||||
const segment = () => {
|
|
||||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
||||||
};
|
|
||||||
return `${segment()}-${segment()}-${segment()}`;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
if (itemUrl.length > 1 && pageUrl.indexOf(itemUrl.replace('/page-0/', '')) === 0) {
|
||||||
|
response += 'data-state="active"';
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take an array of keys and return back items that match.
|
||||||
|
* Note: items in the collection must have a key attribute in
|
||||||
|
* Front Matter.
|
||||||
|
*
|
||||||
|
* @param {Array} collection - 11ty collection.
|
||||||
|
* @param {Array} keys - Collection of keys.
|
||||||
|
* @returns {Array} - Result collection or empty.
|
||||||
|
*/
|
||||||
|
export function filterCollectionByKeys(collection, keys) {
|
||||||
|
return collection.filter(x => keys.includes(x.data.key));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a random UUID (Universally Unique Identifier).
|
||||||
|
*
|
||||||
|
* @returns {string} A random UUID.
|
||||||
|
*/
|
||||||
|
export function random() {
|
||||||
|
const segment = () => {
|
||||||
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
||||||
|
};
|
||||||
|
return `${segment()}-${segment()}-${segment()}`;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,90 +1,87 @@
|
||||||
module.exports = {
|
export const url = process.env.URL || 'http://localhost:8080';
|
||||||
url: process.env.URL || 'http://localhost:8080',
|
export const siteName = 'Eleventy Excellent';
|
||||||
siteName: 'Eleventy Excellent',
|
export const siteDescription =
|
||||||
siteDescription:
|
'Eleventy starter built around the CSS workflow suggested by buildexcellentwebsit.es';
|
||||||
'Eleventy starter built around the CSS workflow suggested by buildexcellentwebsit.es',
|
export const siteType = 'Person'; // schema
|
||||||
siteType: 'Person', // schema
|
export const locale = 'en_EN';
|
||||||
locale: 'en_EN',
|
export const lang = 'en';
|
||||||
lang: 'en',
|
export const skipContent = 'Skip to content';
|
||||||
skipContent: 'Skip to content',
|
export const author = {
|
||||||
author: {
|
name: 'Lene Saile', // i.e. Lene Saile - page / blog author's name. Must be set.
|
||||||
name: 'Lene Saile', // i.e. Lene Saile - page / blog author's name. Must be set.
|
avatar: '/icon-512x512.png', // path to the author's avatar. In this case just using a favicon.
|
||||||
avatar: '/favicon.png',
|
email: 'hola@lenesaile.com', // i.e. hola@lenesaile.com - email of the author
|
||||||
email: 'hola@lenesaile.com', // i.e. hola@lenesaile.com - email of the author
|
website: 'https://www.lenesaile.com' // i.e. https.://www.lenesaile.com - the personal site of the author
|
||||||
website: 'https://www.lenesaile.com' // i.e. https.://www.lenesaile.com - the personal site of the author
|
|
||||||
},
|
|
||||||
creator: {
|
|
||||||
name: 'Lene Saile', // i.e. Lene Saile - creator's (developer) name.
|
|
||||||
email: 'hola@lenesaile.com',
|
|
||||||
website: 'https://www.lenesaile.com',
|
|
||||||
social: 'https://front-end.social/@lene'
|
|
||||||
},
|
|
||||||
themeColor: '#DD4462', // Manifest: defines the default theme color for the application
|
|
||||||
themeBgColor: '#FBFBFB', // Manifest: defines a placeholder background color for the application page to display before its stylesheet is loaded
|
|
||||||
opengraph_default: '/assets/images/template/opengraph-default.jpg', // fallback/default meta image
|
|
||||||
opengraph_default_alt:
|
|
||||||
'Visible content: Eleventy starter built around the CSS workflow for Cube CSS, Every Layout, Design Tokens and Tailwind for uitility, based on the concepts explained in buildexcellentwebsit.es', // alt text for default meta image
|
|
||||||
blog: {
|
|
||||||
// RSS feed
|
|
||||||
name: 'My Web Development Blog',
|
|
||||||
description:
|
|
||||||
'Tell the word what you are writing about in your blog. It will show up on feed readers.',
|
|
||||||
// feed links are looped over in the head. You may add more to the array.
|
|
||||||
feedLinks: [
|
|
||||||
{
|
|
||||||
title: 'Atom Feed',
|
|
||||||
url: '/feed.xml',
|
|
||||||
type: 'application/atom+xml'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// Tags
|
|
||||||
tagSingle: 'Tag',
|
|
||||||
tagPlural: 'Tags',
|
|
||||||
tagMore: 'More tags:',
|
|
||||||
// pagination
|
|
||||||
paginationLabel: 'Blog',
|
|
||||||
paginationPage: 'Page',
|
|
||||||
paginationPrevious: 'Previous',
|
|
||||||
paginationNext: 'Next',
|
|
||||||
paginationNumbers: true
|
|
||||||
},
|
|
||||||
details: {
|
|
||||||
aria: 'section controls',
|
|
||||||
expand: 'expand all',
|
|
||||||
collapse: 'collapse all'
|
|
||||||
},
|
|
||||||
navigation: {
|
|
||||||
ariaTop: 'Main',
|
|
||||||
ariaBottom: 'Complementary',
|
|
||||||
ariaPlatforms: 'Platforms',
|
|
||||||
// activate alternative mobile menu with drawer
|
|
||||||
drawerNav: false,
|
|
||||||
navLabel: 'Menu'
|
|
||||||
},
|
|
||||||
themeSwitch: {
|
|
||||||
title: 'Theme',
|
|
||||||
light: 'light',
|
|
||||||
dark: 'dark',
|
|
||||||
initial: 'select'
|
|
||||||
},
|
|
||||||
greenweb: {
|
|
||||||
// this goues into src/common/greenweb.njk
|
|
||||||
providers: {
|
|
||||||
// if you want to add more than one, edit the array directly.
|
|
||||||
domain: 'netlify.com',
|
|
||||||
service: 'cdn'
|
|
||||||
},
|
|
||||||
credentials: {
|
|
||||||
// optional, eg: { domain='my-org.com', doctype = 'webpage', url = 'https://my-org.com/our-climate-record'}
|
|
||||||
domain: '',
|
|
||||||
doctype: '',
|
|
||||||
url: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
viewRepo: {
|
|
||||||
// this is for the view/edit on github link. The value in the package.json will be pulled in.
|
|
||||||
allow: true,
|
|
||||||
infoText: 'View this page on GitHub'
|
|
||||||
},
|
|
||||||
easteregg: true
|
|
||||||
};
|
};
|
||||||
|
export const creator = {
|
||||||
|
name: 'Lene Saile', // i.e. Lene Saile - creator's (developer) name.
|
||||||
|
email: 'hola@lenesaile.com',
|
||||||
|
website: 'https://www.lenesaile.com',
|
||||||
|
social: 'https://front-end.social/@lene'
|
||||||
|
};
|
||||||
|
export const pathToSvgLogo = 'src/assets/svg/misc/logo.svg'; // used for favicon generation
|
||||||
|
export const themeColor = '#DD4462'; // Manifest: defines the default theme color for the application
|
||||||
|
export const themeBgColor = '#FBFBFB'; // Manifest: defines a placeholder background color for the application page to display before its stylesheet is loaded
|
||||||
|
export const opengraph_default = '/assets/images/template/opengraph-default.jpg'; // fallback/default meta image
|
||||||
|
export const opengraph_default_alt =
|
||||||
|
'Visible content: Eleventy starter built around the CSS workflow for Cube CSS, Every Layout, Design Tokens and Tailwind for uitility, based on the concepts explained in buildexcellentwebsit.es'; // alt text for default meta image
|
||||||
|
export const blog = {
|
||||||
|
// RSS feed
|
||||||
|
name: 'My Web Development Blog',
|
||||||
|
description: 'Tell the word what you are writing about in your blog. It will show up on feed readers.',
|
||||||
|
// feed links are looped over in the head. You may add more to the array.
|
||||||
|
feedLinks: [
|
||||||
|
{
|
||||||
|
title: 'Atom Feed',
|
||||||
|
url: '/feed.xml',
|
||||||
|
type: 'application/atom+xml'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// Tags
|
||||||
|
tagSingle: 'Tag',
|
||||||
|
tagPlural: 'Tags',
|
||||||
|
tagMore: 'More tags:',
|
||||||
|
// pagination
|
||||||
|
paginationLabel: 'Blog',
|
||||||
|
paginationPage: 'Page',
|
||||||
|
paginationPrevious: 'Previous',
|
||||||
|
paginationNext: 'Next',
|
||||||
|
paginationNumbers: true
|
||||||
|
};
|
||||||
|
export const details = {
|
||||||
|
aria: 'section controls',
|
||||||
|
expand: 'expand all',
|
||||||
|
collapse: 'collapse all'
|
||||||
|
};
|
||||||
|
export const navigation = {
|
||||||
|
navLabel: 'Menu',
|
||||||
|
ariaTop: 'Main',
|
||||||
|
ariaBottom: 'Complementary',
|
||||||
|
ariaPlatforms: 'Platforms',
|
||||||
|
drawerNav: false
|
||||||
|
};
|
||||||
|
export const themeSwitch = {
|
||||||
|
title: 'Theme',
|
||||||
|
light: 'light',
|
||||||
|
dark: 'dark'
|
||||||
|
};
|
||||||
|
export const initial = 'select';
|
||||||
|
export const greenweb = {
|
||||||
|
// this goes into src/common/greenweb.njk
|
||||||
|
providers: {
|
||||||
|
// if you want to add more than one, edit the array directly.
|
||||||
|
domain: 'netlify.com',
|
||||||
|
service: 'cdn'
|
||||||
|
},
|
||||||
|
credentials: {
|
||||||
|
// optional, eg: { domain='my-org.com', doctype = 'webpage', url = 'https://my-org.com/our-climate-record'}
|
||||||
|
domain: '',
|
||||||
|
doctype: '',
|
||||||
|
url: ''
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export const viewRepo = {
|
||||||
|
// this is for the view/edit on github link. The value in the package.json will be pulled in.
|
||||||
|
allow: true,
|
||||||
|
infoText: 'View this page on GitHub'
|
||||||
|
};
|
||||||
|
export const easteregg = true;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue