无法构建Eleventy博客。

huangapple go评论128阅读模式
英文:

Failing to build eleventy blog

问题

I am trying to create a personal blog. My directory structure looks like the following:

无法构建Eleventy博客。

My .eleventy.js looks like the following:

module.exports = function (eleventyConfig) {
    eleventyConfig.setTemplateFormats(["md", "html"]);

    // Copy static files to output folder
    eleventyConfig.addPassthroughCopy('src/images');
    eleventyConfig.addPassthroughCopy('src/css');
    eleventyConfig.addPassthroughCopy('src/js');

    // Set input and output folders
    return {
        dir: {
            input: '_src',
            output: '_site',
            includes: '_includes',
            layouts: '_layouts'
        }
    };
};

When I build I get the following:

$ sudo npm run build

> personal_blog_eleventy@1.0.0 build
> eleventy

[11ty] Writing _site/_posts/post-1/index.html from ./_src/_posts/post-1.md (liquid)
[11ty] Writing _site/_posts/post-2/index.html from ./_src/_posts/post-2.md (liquid)
[11ty] Wrote 2 files in 0.11 seconds (v2.0.1)

However, when running eleventy --serve I only get:

无法构建Eleventy博客。

Any suggestions what I am doing wrong?

I appreciate your replies!

英文:

I am trying to create a personal blog. My directory structure looks like the following:

无法构建Eleventy博客。

My .eleventy.js looks like the following:

module.exports = function (eleventyConfig) {
    eleventyConfig.setTemplateFormats(["md", "html"]);

    // Copy static files to output folder
    eleventyConfig.addPassthroughCopy('src/images');
    eleventyConfig.addPassthroughCopy('src/css');
    eleventyConfig.addPassthroughCopy('src/js');

    // Set input and output folders
    return {
        dir: {
            input: '_src',
            output: '_site',
            includes: '_includes',
            layouts: '_layouts'
        }
    };
};

When I build I get the following:

$ sudo npm run build

> personal_blog_eleventy@1.0.0 build
> eleventy

[11ty] Writing _site/_posts/post-1/index.html from ./_src/_posts/post-1.md (liquid)
[11ty] Writing _site/_posts/post-2/index.html from ./_src/_posts/post-2.md (liquid)
[11ty] Wrote 2 files in 0.11 seconds (v2.0.1)

However, when running eleventy --serve I only get:

无法构建Eleventy博客。

Any suggestions what I am doing wrong?

I appreciate your replies!

答案1

得分: 1

你没有一个根目录下的 index.html 文件,所以服务器正确地表示它无法获取路由 /

您可以通过访问 http://localhost:8080/_posts/post-1 来确认,因为该文件确实存在。

英文:

You don't have a root index.html file, so the server is correct in saying it cannot GET the route /.

You can confirm by going to http://localhost:8080/_posts/post-1 as that file does exist.

huangapple
  • 本文由 发表于 2023年4月17日 00:13:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76028919.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定