Navigation plugin needs to work with pathprefix (update dep)
This commit is contained in:
parent
c9018fa45b
commit
93e23c7885
32
.eleventy.js
32
.eleventy.js
@ -3,11 +3,14 @@ const fs = require("fs");
|
|||||||
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
||||||
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
||||||
const pluginNavigation = require("@11ty/eleventy-navigation");
|
const pluginNavigation = require("@11ty/eleventy-navigation");
|
||||||
|
const markdownIt = require("markdown-it");
|
||||||
|
const markdownItAnchor = require("markdown-it-anchor");
|
||||||
|
|
||||||
module.exports = function(eleventyConfig) {
|
module.exports = function(eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(pluginRss);
|
eleventyConfig.addPlugin(pluginRss);
|
||||||
eleventyConfig.addPlugin(pluginSyntaxHighlight);
|
eleventyConfig.addPlugin(pluginSyntaxHighlight);
|
||||||
eleventyConfig.addPlugin(pluginNavigation);
|
eleventyConfig.addPlugin(pluginNavigation);
|
||||||
|
|
||||||
eleventyConfig.setDataDeepMerge(true);
|
eleventyConfig.setDataDeepMerge(true);
|
||||||
|
|
||||||
eleventyConfig.addLayoutAlias("post", "layouts/post.njk");
|
eleventyConfig.addLayoutAlias("post", "layouts/post.njk");
|
||||||
@ -35,24 +38,19 @@ module.exports = function(eleventyConfig) {
|
|||||||
eleventyConfig.addPassthroughCopy("img");
|
eleventyConfig.addPassthroughCopy("img");
|
||||||
eleventyConfig.addPassthroughCopy("css");
|
eleventyConfig.addPassthroughCopy("css");
|
||||||
|
|
||||||
/* Markdown Plugins */
|
/* Markdown Overrides */
|
||||||
let markdownIt = require("markdown-it");
|
let markdownLibrary = markdownIt({
|
||||||
let markdownItAnchor = require("markdown-it-anchor");
|
|
||||||
let options = {
|
|
||||||
html: true,
|
html: true,
|
||||||
breaks: true,
|
breaks: true,
|
||||||
linkify: true
|
linkify: true
|
||||||
};
|
}).use(markdownItAnchor, {
|
||||||
let opts = {
|
|
||||||
permalink: true,
|
permalink: true,
|
||||||
permalinkClass: "direct-link",
|
permalinkClass: "direct-link",
|
||||||
permalinkSymbol: "#"
|
permalinkSymbol: "#"
|
||||||
};
|
});
|
||||||
|
eleventyConfig.setLibrary("md", markdownLibrary);
|
||||||
eleventyConfig.setLibrary("md", markdownIt(options)
|
|
||||||
.use(markdownItAnchor, opts)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
// Browsersync Overrides
|
||||||
eleventyConfig.setBrowserSyncConfig({
|
eleventyConfig.setBrowserSyncConfig({
|
||||||
callbacks: {
|
callbacks: {
|
||||||
ready: function(err, browserSync) {
|
ready: function(err, browserSync) {
|
||||||
@ -76,15 +74,19 @@ module.exports = function(eleventyConfig) {
|
|||||||
],
|
],
|
||||||
|
|
||||||
// If your site lives in a different subdirectory, change this.
|
// If your site lives in a different subdirectory, change this.
|
||||||
// Leading or trailing slashes are all normalized away, so don’t worry about it.
|
// Leading or trailing slashes are all normalized away, so don’t worry about those.
|
||||||
|
|
||||||
// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
|
// If you don’t have a subdirectory, use "" or "/" (they do the same thing)
|
||||||
// This is only used for URLs (it does not affect your file structure)
|
// This is only used for link URLs (it does not affect your file structure)
|
||||||
pathPrefix: "/",
|
// You can also pass this in on the command line using `--pathprefix`
|
||||||
|
|
||||||
|
// pathPrefix: "/",
|
||||||
|
|
||||||
markdownTemplateEngine: "liquid",
|
markdownTemplateEngine: "liquid",
|
||||||
htmlTemplateEngine: "njk",
|
htmlTemplateEngine: "njk",
|
||||||
dataTemplateEngine: "njk",
|
dataTemplateEngine: "njk",
|
||||||
passthroughFileCopy: true,
|
|
||||||
|
// These are all optional, defaults are shown:
|
||||||
dir: {
|
dir: {
|
||||||
input: ".",
|
input: ".",
|
||||||
includes: "_includes",
|
includes: "_includes",
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1 class="home"><a href="{{ '/' | url }}">{{ metadata.title }}</a></h1>
|
<h1 class="home"><a href="{{ '/' | url }}">{{ metadata.title }}</a></h1>
|
||||||
<!-- Read more about `eleventy-navigation` at https://github.com/11ty/eleventy-navigation -->
|
|
||||||
|
{#- Read more about `eleventy-navigation` at https://github.com/11ty/eleventy-navigation #}
|
||||||
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml({
|
{{ collections.all | eleventyNavigation | eleventyNavigationToHtml({
|
||||||
listClass: "nav",
|
listClass: "nav",
|
||||||
listItemClass: "nav-item",
|
listItemClass: "nav-item",
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
layout: layouts/post.njk
|
layout: layouts/post.njk
|
||||||
title: About Me
|
title: About Me
|
||||||
|
templateClass: tmpl-post
|
||||||
eleventyNavigation:
|
eleventyNavigation:
|
||||||
key: About Me
|
key: About Me
|
||||||
order: 2
|
order: 2
|
||||||
templateClass: tmpl-post
|
|
||||||
---
|
---
|
||||||
|
|
||||||
I am a person that writes stuff.
|
I am a person that writes stuff.
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
---
|
---
|
||||||
layout: layouts/home.njk
|
layout: layouts/home.njk
|
||||||
|
permalink: /posts/
|
||||||
eleventyNavigation:
|
eleventyNavigation:
|
||||||
key: Archive
|
key: Archive
|
||||||
order: 3
|
order: 3
|
||||||
permalink: /posts/
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<h1>Archive</h1>
|
<h1>Archive</h1>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"homepage": "https://github.com/11ty/eleventy-base-blog#readme",
|
"homepage": "https://github.com/11ty/eleventy-base-blog#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@11ty/eleventy": "^0.9.0",
|
"@11ty/eleventy": "^0.9.0",
|
||||||
"@11ty/eleventy-navigation": "^0.1.0",
|
"@11ty/eleventy-navigation": "^0.1.1",
|
||||||
"@11ty/eleventy-plugin-rss": "^1.0.7",
|
"@11ty/eleventy-plugin-rss": "^1.0.7",
|
||||||
"@11ty/eleventy-plugin-syntaxhighlight": "^2.0.3",
|
"@11ty/eleventy-plugin-syntaxhighlight": "^2.0.3",
|
||||||
"luxon": "^1.12.0",
|
"luxon": "^1.12.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user