Closed N-Upchurch closed 1 year ago
Is there any documentation on how files should be added to eleventy_ynh?
Yes. Just open the app in your web browser and there should be instructions.
Typically, you should drop your files in /home/yunohost.app/eleventy/src/
I did read that page, but as I recall, it just linked to the eleventy 'get started' documentation. Eleventy does seem to pick up on files when they are added to src/
, but it doesn't find eleventy.config.js
whether it's in /home/yunohost.app/eleventy/src/
or /home/yunohost.app/eleventy/
. I'm very confused as to why it doesn't work, because I'm using the official blog starter (which does not use a src/
directory) and it's running fine locally. (This is why I wondered if there might be a special implementation used here or something)
I think eleventy.config.js
should lives at /var/www/eleventy/.eleventy.js
Looks like the doc/ADMIN.md is partially broken.
I just attempted to restart with eleventy.config.js
moved / renamed to /var/www/eleventy/.eleventy.js
, and it still fails to render any templates. I'm seeing Error: filter not found: htmlDateString
in the log. htmlDateString()
is defined in /var/www/eleventy/.eleventy.js
.
Can you try to restart the service after modifying .eleventy.js
? sudo yunohost service restart eleventy
Yea, I've been doing that each time.
Log:
-- Journal begins at Sat 2023-06-24 17:03:40 EDT, ends at Wed 2023-06-28 09:34:57 EDT. --
Jun 28 09:34:55 cmd.js[4163356]: [11ty] 2. (/home/yunohost.app/eleventy/src/content/blog.njk)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] Template render error: (/home/yunohost.app/eleventy/src/_includes/postslist.njk)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] Error: filter not found: htmlDateString (via Template render error)
Jun 28 09:34:55 cmd.js[4163356]: [11ty]
Jun 28 09:34:55 cmd.js[4163356]: [11ty] Original error stack trace: Template render error: (/home/yunohost.app/eleventy/src/content/blog.njk)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] Template render error: (/home/yunohost.app/eleventy/src/_includes/postslist.njk)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] Error: filter not found: htmlDateString
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at Object._prettifyError (/var/www/eleventy/node_modules/nunjucks/src/lib.js:32:11)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at /var/www/eleventy/node_modules/nunjucks/src/environment.js:464:19
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at eval (eval at _compile (/var/www/eleventy/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:30:11)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at /var/www/eleventy/node_modules/nunjucks/src/environment.js:471:11
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at Template.root [as rootRenderFunc] (eval at _compile (/var/www/eleventy/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:94:3)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at Template.render (/var/www/eleventy/node_modules/nunjucks/src/environment.js:454:10)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at eval (eval at _compile (/var/www/eleventy/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:29:10)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at fn (/var/www/eleventy/node_modules/a-sync-waterfall/index.js:26:24)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at /var/www/eleventy/node_modules/a-sync-waterfall/index.js:66:22
Jun 28 09:34:55 cmd.js[4163356]: [11ty] at executeSync (/var/www/eleventy/node_modules/a-sync-waterfall/index.js:8:15)
Jun 28 09:34:55 cmd.js[4163356]: [11ty] Wrote 0 files in 0.49 seconds (v2.0.1)
Jun 28 09:34:55 systemd[1]: eleventy.service: Main process exited, code=exited, status=1/FAILURE
Jun 28 09:34:55 systemd[1]: eleventy.service: Failed with result 'exit-code'.
Jun 28 09:34:55 systemd[1]: eleventy.service: Scheduled restart job, restart counter is at 4.
Jun 28 09:34:55 systemd[1]: Stopped Eleventy: Simpler site generator.
Jun 28 09:34:55 systemd[1]: Started Eleventy: Simpler site generator.
Jun 28 09:34:56 cmd.js[4163370]: [11ty] Problem writing Eleventy templates: (more in DEBUG output)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] 1. Having trouble rendering njk template /home/yunohost.app/eleventy/src/content/blog.njk (via TemplateContentRenderError)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] 2. (/home/yunohost.app/eleventy/src/content/blog.njk)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] Template render error: (/home/yunohost.app/eleventy/src/_includes/postslist.njk)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] Error: filter not found: htmlDateString (via Template render error)
Jun 28 09:34:56 cmd.js[4163370]: [11ty]
Jun 28 09:34:56 cmd.js[4163370]: [11ty] Original error stack trace: Template render error: (/home/yunohost.app/eleventy/src/content/blog.njk)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] Template render error: (/home/yunohost.app/eleventy/src/_includes/postslist.njk)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] Error: filter not found: htmlDateString
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at Object._prettifyError (/var/www/eleventy/node_modules/nunjucks/src/lib.js:32:11)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at /var/www/eleventy/node_modules/nunjucks/src/environment.js:464:19
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at eval (eval at _compile (/var/www/eleventy/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:30:11)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at /var/www/eleventy/node_modules/nunjucks/src/environment.js:471:11
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at Template.root [as rootRenderFunc] (eval at _compile (/var/www/eleventy/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:94:3)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at Template.render (/var/www/eleventy/node_modules/nunjucks/src/environment.js:454:10)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at eval (eval at _compile (/var/www/eleventy/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:29:10)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at fn (/var/www/eleventy/node_modules/a-sync-waterfall/index.js:26:24)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at /var/www/eleventy/node_modules/a-sync-waterfall/index.js:66:22
Jun 28 09:34:56 cmd.js[4163370]: [11ty] at executeSync (/var/www/eleventy/node_modules/a-sync-waterfall/index.js:8:15)
Jun 28 09:34:56 cmd.js[4163370]: [11ty] Wrote 0 files in 0.59 seconds (v2.0.1)
Jun 28 09:34:56 systemd[1]: eleventy.service: Main process exited, code=exited, status=1/FAILURE
Jun 28 09:34:56 systemd[1]: eleventy.service: Failed with result 'exit-code'.
Jun 28 09:34:57 systemd[1]: eleventy.service: Scheduled restart job, restart counter is at 5.
Jun 28 09:34:57 systemd[1]: Stopped Eleventy: Simpler site generator.
Jun 28 09:34:57 systemd[1]: eleventy.service: Start request repeated too quickly.
Jun 28 09:34:57 systemd[1]: eleventy.service: Failed with result 'exit-code'.
Jun 28 09:34:57 systemd[1]: Failed to start Eleventy: Simpler site generator.
I also figured that permissions might be an issue - the SFTP user is unlikely to be eleventy, so I tried running sudo setfacl -Rdm u:eleventy:rwx ./*
in eleventy/
just to be sure eleventy had write permissions.
Can you share your /var/www/eleventy/.eleventy.js
?
Not sure what's broken with your setup, but I managed to get it working with this :
$ sudo cat /var/www/eleventy/.eleventy.js
const { DateTime } = require("luxon");
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("/home/yunohost.app/eleventy/src/style.css");
eleventyConfig.addFilter('htmlDateString', (dateObj) => {
// dateObj input: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
return DateTime.fromJSDate(dateObj, {zone: 'utc'}).toFormat('yyyy-LL-dd');
});
return {
dir: {
input: "/home/yunohost.app/eleventy/src",
output: "/home/yunohost.app/eleventy/public",
},
};
};
$ sudo cat /home/yunohost.app/eleventy/src/index.md
---
title: Hello world
layout: "base.njk"
date: 2018-08-04
---
{{ page.date | htmlDateString }}
Thanks for your help. Seeing your config showed me that I had some issues with my paths. I also made progress by moving package.json
and package-lock.json
to /var/www/eleventy/
and running npm install
, but in the end, I kept having issues with templates not being found, et cetera, and needing to move config files and change relative paths was going to make further development and deployment of my site too cumbersome, so I decided to use my_webapp_ynh instead and just upload my output folder via SFTP.
When dropping in a working 11ty project to /home/yunohost.app/eleventy, 0 pages are generated. Is there any documentation on how files should be added to eleventy_ynh?