Git Product home page Git Product logo

danurbanowicz / eleventy-netlify-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
515.0 14.0 183.0 476 KB

A template for building a blog with the Eleventy static site generator and Decap CMS

Home Page: https://eleventy-netlify-boilerplate.netlify.app/

License: MIT License

HTML 11.06% CSS 15.85% JavaScript 33.58% Nunjucks 39.52%
eleventy static-site-generator boilerplate netlify netlify-cms jamstack cms 11ty blog-theme decap-cms

eleventy-netlify-boilerplate's Introduction

eleventy-netlify-boilerplate's People

Contributors

biilmann avatar d2s avatar danurbanowicz avatar dependabot[bot] avatar ohadpr avatar spekulatius avatar tylermroderick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eleventy-netlify-boilerplate's Issues

Form submissions not working

Describe the bug
I deployed this project to Netlify, but the form submissions were not working for me. The "forms" tab in my Netlify dashboard also didn't show any active forms.

Solution
On the <form> tag, I replaced netlify with data-netlify="true" and that fixed the problem. The Netlify forms documentation still seems to support the netlify attribute alone, so I'm not sure why this was an issue. Either way, I'm just leaving a note here in case anyone else runs into the same issue.

Thanks for the boilerplate 👍

Default title for tag page

Hello @danurbanowicz

I was wondering if you could give me a hint on how to change the default title for the tag pages. I've tried to add different versions of "title" to the front of the tags.njk-file but non succeeded.

Cheers,
Peter

'Invalid DateTime' in article

Describe the bug
Hi. I'm using the boilerplate to render a static version of a Wordpress site I'm wanting to mothball, but the outputted date seems to be different between the blog postslist page and an individual post.

On the postslist page, I think the boilerplate is using postlists.njk to output a post.date, whereas on an individual post/article, it uses post.njk and tries to use machineDate and readableDate (but outputs "Invalid DateTime").

date outputs a date on the individual post/article page, but not in the same format as the postslist page. I'm hoping to display the date in the same format on both types of page.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to https://coderkind-eleventy.netlify.app/blog/
  2. See dates are in a format similar to "06 Aug 2019"
  3. Go to individual post page: https://coderkind-eleventy.netlify.app/2019/08/06/13-npm-tricks-for-faster-javascript-development/
  4. Date displays as "Invalid DateTime"

Expected behavior
The date should be in a similar format on postslists and individual post pages

Additional context
Markdown format of posts: https://github.com/coderkind/coderkind-eleventy-netlify/blob/master/posts/2019/08/06/13-npm-tricks-for-faster-javascript-development/index.md

markdownit options are created but not used

/* Markdown Plugins */
let markdownIt = require("markdown-it");
let options = {
html: true,
breaks: true,
linkify: true
};

I ended up getting a bit confused by the presence of this block given the removal of the call to
eleventyConfig.setLibrary("md", markdownIt(options)); (removed in 42084ba, perhaps as collateral when removing markdownit-anchor?)

I think it'd be clearer either to make the call to set the options, or remove the block containing the options. In my case this was confusing because at first pass I was expecting breaks to be enabled, but they weren't as the default config was being used, which has breaks: false

(If removing the config, I think the block below can go too)

Markdown widget not wrapping output with HTML

Hi, I'm using your boilerplate for my project and is using many markdown widgets on a single collection.

In my config.yml, i have this as one of my fields:
- { label: "Description", name: "featureDescription", widget: "markdown" }
I have a multi-paragraph content which then saves to my file.md's frontmatter like this:
image

and using {{ projectInformation.projectDescription }} it gets displayed in my site like this:
image

Also saw this in the netlifycms doc:
Please note: The markdown widget outputs a raw markdown string. Your static site generator may or may not render the markdown to HTML automatically. Consult with your static site generator's documentation for more information about rendering markdown.

Can you help me out? Thanks!

Using TailwindCSS

Hey man, I've been looking into Tailwind x Eleventy projects all day and so far they have all been based off of skeleton templates of Eleventy. Do you have any idea how I could use Tailwind with this template: set up, required plugin etc.

Thanks for your help.

Problem writing eleventy templates (more info in DEBUG output)

I keep getting this error in the terminal after build.

Here is the DEBUG output:

Error with passthrough copy: (more in DEBUG output)

Having trouble copying './static/img'

TemplatePassthroughManagerCopyError was thrown

EPERM: operation not permitted, open 'C:\Users\kyles\Desktop\moonface_site\static\img\715580bf-9f2c-4e74-b0c5-7649f02ebfa1.webm'

Error was thrown:

Unhandled rejection in promise ([object Promise]): (more in DEBUG output)

Having trouble copying

TemplateWriterWriteError was thrown

Having trouble copying './static/img'

TemplatePassthroughManagerCopyError was thrown

EPERM: operation not permitted, open 'C:\Users\kyles\Desktop\moonface_site\static\img\715580bf-9f2c-4e74-b0c5-7649f02ebfa1.webm'

Error was thrown:

    Error: EPERM: operation not permitted, open 'C:\Users\kyles\Desktop\moonface_site\static\img\715580bf-9f2c-4e74-b0c5-7649f02ebfa1.webm'

    Error: EPERM: operation not permitted, open 'C:\Users\kyles\Desktop\moonface_site\static\img\715580bf-9f2c-4e74-b0c5-7649f02ebfa1.webm'

Problem writing Eleventy templates: (more in DEBUG output)

Output conflict: multiple input files are writing to _site/authors/the-moonface-team/index.html. Use distinct permalink values to resolve this conflict.

  1. ./author.njk

  2. ./author.njk

DuplicatePermalinkOutputError was thrown:

    (Repeated output has been truncated...)

        at TemplateMap.checkForDuplicatePermalinks (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateMap.js:547:13)

        at TemplateMap.cache (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateMap.js:308:10)      

        at processTicksAndRejections (internal/process/task_queues.js:93:5)

        at async TemplateWriter._createTemplateMap (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateWriter.js:170:5)

        at async TemplateWriter.writeTemplates (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateWriter.js:203:5)

        at async TemplateWriter.write (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateWriter.js:254:25)

        at async Eleventy.write (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\Eleventy.js:743:13)      

        at async Eleventy._watch (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\Eleventy.js:488:5)      

        at async Timeout._onTimeout (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\Eleventy.js:678:11)  

Copied 19 files / Wrote 0 files in 1.78 seconds (v0.11.1)

Watching...

[Browsersync] Reloading Browsers...

File changed: posts\christmas-wishes-from-moonface.md

Problem writing Eleventy templates: (more in DEBUG output)

    (Repeated output has been truncated...)

        at TemplateMap.checkForDuplicatePermalinks (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateMap.js:547:13)

        at TemplateMap.cache (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateMap.js:308:10)      

        at runMicrotasks ()

        at processTicksAndRejections (internal/process/task_queues.js:93:5)

        at async TemplateWriter._createTemplateMap (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateWriter.js:170:5)

        at async TemplateWriter.writeTemplates (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateWriter.js:203:5)

        at async TemplateWriter.write (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\TemplateWriter.js:254:25)

        at async Eleventy.write (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\Eleventy.js:743:13)      

        at async Eleventy._watch (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\Eleventy.js:488:5)      

        at async Timeout._onTimeout (C:\Users\kyles\Desktop\moonface\node_modules@11ty\eleventy\src\Eleventy.js:678:11)  

Copied 34 files / Wrote 0 files in 0.98 seconds (v0.11.1)

Watching...

Error npm installing this on WSL bash on Win10

verbose stack Error: ENOENT: no such file or directory, rename '/c/Users/Osbor/Dropbox/www/ssg-11ty/eleventy-netlify-boilerplate/node_modules/lodash' -> '/c/Users/Osbor/Dropbox/www/ssg-11ty/eleventy-netlify-boilerplate/node_modules/.lodash.DELETE'

npm.log

node version is 10.16.3
Ubuntu version is 18.04 LTS

date time issues

I'm aware of the Eleventy pitfall with datetime. Did you find a way to get around it using Netlify CMS's datetime widget? I haven't resolved it and would love any pointers if you have them.

Thanks!

Multiple authors ?

Hi there;
thank you very much for your great boilerplate. I'm super new with 11ty+netlify CMS (coming from Jekyll+prose) and it looks amazing.

I see there's one author displayed on every post I create which is you. I understood it comes from metadata.json data file but how does it work if I have a multi-authors blog? Let's say there a few people with their own netlify identity who connect to the CMS and write their own post: is it possible to have their name in author then and if yes, how?

Thanks a lot

error in building after changing the image at homepage (maybe template syntax error)

Describe the bug
After I change the homepage image, the site is not longer building

To Reproduce
Steps to reproduce the behavior:

  1. change homepage image by uploading new image from the cms.
  2. website no longer builds

Expected behavior
website should build and deploy with new uploaded image.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser edge
  • Version 120.0.2210.91 (Official build) (64-bit)

TemplatePassthroughManagerCopyError

`TemplatePassthroughManagerCopyError` was thrown
> EPERM: operation not permitted, open 'C:\Users\kyles\Desktop\moonface\_site\static\img\715580bf-9f2c-4e74-b0c5-7649f02ebfa1.webm'
Error: EPERM: operation not permitted, open 'C:\Users\kyles\Desktop\moonface\_site\static\img\715580bf-9f2c-4e74-b0c5-7649f02ebfa1.webm'

Here is my templateformats in .eleventy.js

return {
 templateFormats: ["md", "njk", "html", "liquid", "jpg", "png", "webm", "webp", "ico", "svg", "gif"],

 // If your site lives in a different subdirectory, change this.
 // Leading or trailing slashes are all normalized away, so don’t worry about it.
 // 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)
 pathPrefix: "/",

 markdownTemplateEngine: "liquid",
 htmlTemplateEngine: "njk",
 dataTemplateEngine: "njk",
 dir: {
   input: ".",
   includes: "_includes",
   data: "_data",
   output: "_site"
 }

Windows 10

Security Issue warnings

as soon as I forked this repo (as part of the Netlify setup) I got security warnings on Github. Not sure how to fix it...

Small typo

Hi,

When I cloned the repro there was a small typo at:
eleventy-netlify-boilerplate/admin/config.yml

Line 27 should be:
create: false (without the single quotes)

Thanks for the starter project, it works great!

Preview of a post in netlifycms broken

Without any change on my side since a few days/weeks ago there is the following error in Safari-Console:

Failed to load resource: Cross-origin redirection to https://unpkg.com/[email protected]/dist/htm.module.js?module denied by Cross-Origin Resource Sharing policy: Origin https://www.domainnamechangedforthisissue.de is not allowed by Access-Control-Allow-Origin. https://www.domainnamechangedforthisissue.de/.netlify/git/github/contents/.gitattributes?ts=1573207213206&ref=master

Is this a unpkg.com-related problem? I’m a bit lost and cannot find any pointers to this...

Is the tag post really necessary?

I'm trying to wrap my head around this:
The tag "post" is specified in all posts/*.md files and also in the posts/posts.json file. As far as I understand this would allow to access collections.post, thought it would be unnecessary to specify the tag for all post md files. Anyway, I notice that a collection "posts" is added in the .eleventy.js config file which is then used to display the list of posts under blog.
I'm trying to understand all this because I'm having issues using collections.[tagname] when specifying that tagname only in the directory configuration file.
Any help and clarification on this would be much appreciated.
Thanks!

How can I activate drafts?

Hi there,
I'm trying to make it work. Our setting is that we're a few people just wanting to blog easily. But for that, we definetely need to be able to write drafts. From Netlify CMS I see there should be that kind of feature but it doesn't seem to show on my side. Is it coming from the way your boilerplate is structured? And if yes, would you know what's to change in order to activate that kind of features on Netlify CMS please?

Thanks a lot :)

Moving rooted templates to directories.

I have moved authors.njk , author.njk and tags.njk to my layouts directory and it is causing strange behaviour, is there something I need to update in order to do this.

I have also added 404.md to my pages directory and this also is causing some strange things to happen.

I moved these files purely to clean things up a little bit so if there is absolutely no way to get around this then let me know and I'll just keep the files where they are.

Feature Requests

Is there something you wish Eleventy Netlify Boilerplate did that it doesn't, or do you have an idea to make it better?

If so, please add it here!

Making images work when posts have a year/month/title structure

Hi,

I am trying to use this boilerplate, but I have an issue with images. My structure is as follows:

/posts
  /2023
    /08
      /post-title
        index.md

To display posts in Netlify CMS, I have to add path in config.yml like this, otherwise, it shows "No entry":
path: "{{year}}/{{month}}/{{month}}/{{slug}}/index"

But then, if I upload an image, it places it in /posts/2023/08/post-title/ instead of /static/img. And in the Markdown editor, it generates ![](image.jpg) instead of ![](/static/img/image.jpg

If I remove path from config.yml, I can create a new post (but then it goes into /posts/new-post.md), and the image is correctly placed in /static/img/

Than you.

support for images

hey Im trying to just add images to posts and the home page

i added the png to the /img folder and referencing them in the home.md and the firstpost.md with the following format

![](/img/CryptoArtDigestLogo.png)

is there anything else I need to do? they wont show up and im used to this working on another gatsbyJS site I use.

Add Sass support

Hello, im still new to javascript. Can you help me add a Sass preprocessor in here? We really need it in our process. The Sass folder layout in the root looks like this
image

Can it be added in the .eleventy.js file so it will still be watched on "eleventy --serve" ?

const { DateTime } = require("luxon");
const CleanCSS = require("clean-css");
const UglifyJS = require("uglify-es");
const htmlmin = require("html-minifier");

module.exports = function(eleventyConfig) {
  eleventyConfig.addLayoutAlias("post", "layouts/post.njk");

  // Date formatting (human readable)
  eleventyConfig.addFilter("readableDate", dateObj => {
    return DateTime.fromJSDate(dateObj).toFormat("dd LLL yyyy");
  });

  // Date formatting (machine readable)
  eleventyConfig.addFilter("machineDate", dateObj => {
    return DateTime.fromJSDate(dateObj).toFormat("yyyy-MM-dd");
  });

  // Minify CSS
  eleventyConfig.addFilter("cssmin", function(code) {
    return new CleanCSS({}).minify(code).styles;
  });

  // Minify JS
  eleventyConfig.addFilter("jsmin", function(code) {
    let minified = UglifyJS.minify(code);
    if (minified.error) {
      console.log("UglifyJS error: ", minified.error);
      return code;
    }
    return minified.code;
  });

  // Minify HTML output
  eleventyConfig.addTransform("htmlmin", function(content, outputPath) {
    if (outputPath.indexOf(".html") > -1) {
      let minified = htmlmin.minify(content, {
        useShortDoctype: true,
        removeComments: true,
        collapseWhitespace: true
      });
      return minified;
    }
    return content;
  });

  // only content in the `posts/` directory
  eleventyConfig.addCollection("posts", function(collection) {
    return collection.getAllSorted().filter(function(item) {
      return item.inputPath.match(/^\.\/posts\//) !== null;
    });
  });

  // Don't process folders with static assets e.g. images
  eleventyConfig.addPassthroughCopy("static/img");
  eleventyConfig.addPassthroughCopy("img");
  eleventyConfig.addPassthroughCopy("_redirects");
  eleventyConfig.addPassthroughCopy("sitemap.xml");
  eleventyConfig.addPassthroughCopy("robots.txt");
  eleventyConfig.addPassthroughCopy("admin");
  eleventyConfig.addPassthroughCopy("_includes/assets/");

  /* Markdown Plugins */
  let markdownIt = require("markdown-it");
  let options = {
    html: true,
    breaks: true,
    linkify: true
  };
  let opts = {
    permalink: true,
    permalinkClass: "direct-link",
    permalinkSymbol: "#"
  };

  return {
    templateFormats: ["md", "njk", "html"],

    // If your site lives in a different subdirectory, change this.
    // Leading or trailing slashes are all normalized away, so don’t worry about it.
    // 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)
    pathPrefix: "/",

    markdownTemplateEngine: "liquid",
    htmlTemplateEngine: "njk",
    dataTemplateEngine: "njk",
    passthroughFileCopy: true,
    dir: {
      input: ".",
      includes: "_includes",
      data: "_data",
      output: "_site"
    }
  };
};

How was the /about page generated?

The about page seems to be generated with nonsense phrases but is much more interesting than the standard "lorem ipsum" text. What was used to generate that (or was it all handwritten 😮 )?

CMS access for private forked repo

Describe the bug
Not able to use Netlify CMS when forked as private repo.

To Reproduce
Steps to reproduce the behavior:

  1. Fork repo as Private and access <siteurl>/admin
  2. Not able to login using Netlify auth

Expected behavior
Should be able to access /admin for private repo too

Desktop (please complete the following information):

  • OS: Not OS specific, but tested in Ubuntu and Win10
  • Browser: all browsers
  • Version: 9 Dec 2020

Smartphone (please complete the following information):

  • Device: Not specific
  • OS: Not specific
  • Browser: Chrome
  • Version: 9 Dec 2020

Additional context
Posted same question in Netlify Community: https://community.netlify.com/t/allowing-git-gateway-for-single-private-repo/28933

Images and text are not fully responsive/cut off on mobile

Not sure if its a CSS issue or you'd need to use something like the Eleventy image responsiver plugin, but it would be nice for the text and images to be fully responsive and not cut off on mobile and browser resize.

Taken on my computer (not zoomed):
Screen Shot 2020-06-23 at 1 21 50 PM

Taken on my phone (not zoomed):

Thank you!

Auto-redirect doesn't work

On production (netlify) there is a problem with the redirect after the login in admin area.
I tried to insert this in homepage... it's works fine but just on local:
<script> if (window.netlifyIdentity) { window.netlifyIdentity.on("init", user => { if (!user) { window.netlifyIdentity.on("login", () => { document.location.href = "/admin/"; }); } }); } </script>

in production I still have to press the button: "Login with Netlify Identity"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.