A few more tweaks
This commit is contained in:
parent
447028c3a9
commit
87f15a24bd
@ -15,9 +15,9 @@ A starter repository showing how to build a blog with the [Eleventy](https://git
|
||||
Deploy this Eleventy site in just a few clicks on these services:
|
||||
|
||||
- [Get your own Eleventy web site on Netlify](https://app.netlify.com/start/deploy?repository=https://github.com/11ty/eleventy-base-blog)
|
||||
- If you run Eleventy locally you can drag your `_site` folder to [`drop.netlify.com`](https://drop.netlify.com/) to upload it!
|
||||
- [Get your own Eleventy web site on Vercel](https://vercel.com/import/project?template=11ty%2Feleventy-base-blog)
|
||||
|
||||
Or, read more about [Deploying an Eleventy project](https://www.11ty.dev/docs/deployment/).
|
||||
- Read more about [Deploying an Eleventy project](https://www.11ty.dev/docs/deployment/) to the web.
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
@ -8,7 +8,7 @@ Leverage agile frameworks to provide a robust synopsis for high level overviews.
|
||||
|
||||
Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.
|
||||
|
||||
{% imageOptimized "./fourthpost/possum.png", "A possum parent and two possum kids hanging from the iconic red balloon" %}
|
||||
{% imageOptimized "./possum.png", "A possum parent and two possum kids hanging from the iconic red balloon" %}
|
||||
|
||||
## Section Header
|
||||
|
@ -5,8 +5,8 @@ const markdownItAnchor = require("markdown-it-anchor");
|
||||
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
||||
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
||||
const pluginNavigation = require("@11ty/eleventy-navigation");
|
||||
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
|
||||
const eleventyImage = require("@11ty/eleventy-img");
|
||||
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
|
||||
|
||||
function relativeToInputPath(inputPath, relativeFilePath) {
|
||||
let split = inputPath.split(path.sep);
|
||||
@ -24,10 +24,6 @@ module.exports = function(eleventyConfig) {
|
||||
"./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css"
|
||||
});
|
||||
|
||||
// If your passthrough copy gets heavy and cumbersome, add this line
|
||||
// to emulate the file copy on the dev server. Learn more: https://www.11ty.dev/docs/copy/#emulate-passthrough-copy-during-serve
|
||||
// eleventyConfig.setServerPassthroughCopyBehavior("passthrough");
|
||||
|
||||
// Plugins
|
||||
eleventyConfig.addPlugin(pluginRss);
|
||||
eleventyConfig.addPlugin(pluginSyntaxHighlight);
|
||||
@ -35,12 +31,14 @@ module.exports = function(eleventyConfig) {
|
||||
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
|
||||
|
||||
// Shortcodes
|
||||
eleventyConfig.addPlugin(eleventyConfig => {
|
||||
eleventyConfig.addAsyncShortcode("imageOptimized", async function imageShortcode(src, alt, sizes) {
|
||||
let file = relativeToInputPath(this.page.inputPath, src);
|
||||
let metadata = await eleventyImage(file, {
|
||||
widths: ["auto"],
|
||||
formats: ["webp", "png"], // Can add "avif" or "jpeg" here
|
||||
outputDir: "_site/img/"
|
||||
// Can add "avif" or "jpeg" here if you’d like!
|
||||
formats: ["webp", "png"],
|
||||
outputDir: path.join(eleventyConfig.dir.output, "img"),
|
||||
});
|
||||
let imageAttributes = {
|
||||
alt,
|
||||
@ -50,6 +48,7 @@ module.exports = function(eleventyConfig) {
|
||||
};
|
||||
return eleventyImage.generateHTML(metadata, imageAttributes);
|
||||
});
|
||||
})
|
||||
|
||||
// Filters
|
||||
eleventyConfig.addFilter("readableDate", (dateObj, format = "dd LLLL yyyy") => {
|
||||
@ -104,6 +103,14 @@ module.exports = function(eleventyConfig) {
|
||||
});
|
||||
});
|
||||
|
||||
// Features to make your build faster (as you need them)
|
||||
|
||||
// If your passthrough copy gets heavy and cumbersome, add this line
|
||||
// to emulate the file copy on the dev server. Learn more:
|
||||
// https://www.11ty.dev/docs/copy/#emulate-passthrough-copy-during-serve
|
||||
|
||||
// eleventyConfig.setServerPassthroughCopyBehavior("passthrough");
|
||||
|
||||
return {
|
||||
// Control which files Eleventy will process
|
||||
// e.g.: *.md, *.njk, *.html, *.liquid
|
||||
@ -126,10 +133,11 @@ module.exports = function(eleventyConfig) {
|
||||
includes: "_includes",
|
||||
data: "_data",
|
||||
output: "_site"
|
||||
}
|
||||
},
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Optional:
|
||||
// Optional items:
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// If your site deploys to a subdirectory, change `pathPrefix`.
|
||||
// Read more: https://www.11ty.dev/docs/config/#deploy-to-a-subdirectory-with-a-path-prefix
|
||||
@ -137,9 +145,6 @@ module.exports = function(eleventyConfig) {
|
||||
// When paired with the HTML <base> plugin https://www.11ty.dev/docs/plugins/html-base/
|
||||
// it will transform any absolute URLs in your HTML to include this
|
||||
// folder name and does **not** affect where things go in the output folder.
|
||||
|
||||
// Optional (default is shown)
|
||||
// pathPrefix: "/",
|
||||
// -----------------------------------------------------------------
|
||||
pathPrefix: "/",
|
||||
};
|
||||
};
|
||||
|
@ -5,12 +5,10 @@
|
||||
"scripts": {
|
||||
"build": "npx @11ty/eleventy",
|
||||
"build-ghpages": "npx @11ty/eleventy --pathprefix=/eleventy-base-blog/",
|
||||
"bench": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy",
|
||||
"watch": "npx @11ty/eleventy --watch",
|
||||
"serve": "npx @11ty/eleventy --serve",
|
||||
"start": "npx @11ty/eleventy --serve --quiet",
|
||||
"start-ghpages": "npx @11ty/eleventy --serve --quiet --pathprefix=/eleventy-base-blog/",
|
||||
"debug": "DEBUG=Eleventy* npx @11ty/eleventy"
|
||||
"debug": "DEBUG=Eleventy* npx @11ty/eleventy",
|
||||
"benchmark": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Loading…
Reference in New Issue
Block a user