Move to use a content folder instead of everything in root.

This commit is contained in:
Zach Leatherman 2023-01-23 14:50:45 -06:00
parent ea6acf2f6d
commit 216a9de439
19 changed files with 10 additions and 12 deletions

View File

@ -81,9 +81,9 @@ DEBUG=Eleventy* npx @11ty/eleventy
### Implementation Notes ### Implementation Notes
- `about/index.md` is an example of a content page. - `content/about/index.md` is an example of a content page.
- `blog/` has the blog posts but really they can live in any directory. They need only the `post` tag to be included in the blog posts [collection](https://www.11ty.dev/docs/collections/). - `content/blog/` has the blog posts but really they can live in any directory. They need only the `post` tag to be included in the blog posts [collection](https://www.11ty.dev/docs/collections/).
- Use the `eleventyNavigation` key (via the [Eleventy Navigation plugin](https://www.11ty.dev/docs/plugins/navigation/)) in your front matter to add a template to the top level site navigation. This is in use on `index.njk` and `about/index.md`. - Use the `eleventyNavigation` key (via the [Eleventy Navigation plugin](https://www.11ty.dev/docs/plugins/navigation/)) in your front matter to add a template to the top level site navigation. This is in use on `content/index.njk` and `content/about/index.md`.
- Content can be in _any template format_ (blog posts neednt exclusively be markdown, for example). Configure your projects supported templates in `eleventy.config.js` -> `templateFormats`. - Content can be in _any template format_ (blog posts neednt exclusively be markdown, for example). Configure your projects supported templates in `eleventy.config.js` -> `templateFormats`.
- The `public` folder in your input directory will be copied to the output folder (via `addPassthroughCopy` in the `eleventy.config.js` file). This means `./public/css/*` will live at `./_site/css/*` after your build completes. - The `public` folder in your input directory will be copied to the output folder (via `addPassthroughCopy` in the `eleventy.config.js` file). This means `./public/css/*` will live at `./_site/css/*` after your build completes.
- The blog post feed template is in `feed/feed.njk`. This feed also uses the global data file at `_data/metadata.json`. - The blog post feed template is in `feed/feed.njk`. This feed also uses the global data file at `_data/metadata.json`.

View File

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 127 KiB

View File

@ -15,10 +15,6 @@ function relativeToInputPath(inputPath, relativeFilePath) {
} }
module.exports = function(eleventyConfig) { module.exports = function(eleventyConfig) {
// Dont process these files
// https://www.11ty.dev/docs/ignores/#configuration-api
eleventyConfig.ignores.add("README.md");
// Copy the contents of the `public` folder to the output folder // Copy the contents of the `public` folder to the output folder
// For example, `./public/css/` ends up in `_site/css/` // For example, `./public/css/` ends up in `_site/css/`
eleventyConfig.addPassthroughCopy({ eleventyConfig.addPassthroughCopy({
@ -30,7 +26,8 @@ module.exports = function(eleventyConfig) {
// https://www.11ty.dev/docs/watch-serve/#add-your-own-watch-targets // https://www.11ty.dev/docs/watch-serve/#add-your-own-watch-targets
// Process content images to the image pipeline. // Process content images to the image pipeline.
eleventyConfig.addWatchTarget("**/*.(png|jpeg)"); eleventyConfig.addWatchTarget("content/**/*.{png,jpeg}");
// Plugins // Plugins
eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginRss);
@ -136,11 +133,11 @@ module.exports = function(eleventyConfig) {
// Pre-process *.html files with: (default: `liquid`) // Pre-process *.html files with: (default: `liquid`)
htmlTemplateEngine: "njk", htmlTemplateEngine: "njk",
// These are all optional (defaults are shown): // These are all optional:
dir: { dir: {
input: ".", input: "content", // default: "."
includes: "_includes", includes: "../_includes", // default: "_includes"
data: "_data", data: "../_data", // default: "_data"
output: "_site" output: "_site"
}, },

View File

@ -8,6 +8,7 @@
"serve": "npx @11ty/eleventy --serve", "serve": "npx @11ty/eleventy --serve",
"start": "npx @11ty/eleventy --serve --quiet", "start": "npx @11ty/eleventy --serve --quiet",
"debug": "DEBUG=Eleventy* npx @11ty/eleventy", "debug": "DEBUG=Eleventy* npx @11ty/eleventy",
"debugstart": "DEBUG=Eleventy* npx @11ty/eleventy --serve --quiet",
"benchmark": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy" "benchmark": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy"
}, },
"repository": { "repository": {