Eleventy: Access Static Files Inside Static Folder

Created on 27 Apr 2020  路  2Comments  路  Source: 11ty/eleventy

With Hugo, all static files put together inside "static" folder. I tried to use "static" folder with 11ty, but each files inside must be accessed through ./static/file-name. How to access each static files through /file-name without any ./static/ path?

education

Most helpful comment

In Eleventy, you have more flexibility with the directory structure. It will look in the input directory, which by default is the project's top level. For example, if you set /src as the input directory, you then can put the static files anywhere within there and refer to them as /path/to/filename.ext (i.e., rather than /src/path/to/filename.ext). For more details, see https://www.11ty.dev/docs/config/ (and, more specifically, https://www.11ty.dev/docs/config/#input-directory).

All 2 comments

In Eleventy, you have more flexibility with the directory structure. It will look in the input directory, which by default is the project's top level. For example, if you set /src as the input directory, you then can put the static files anywhere within there and refer to them as /path/to/filename.ext (i.e., rather than /src/path/to/filename.ext). For more details, see https://www.11ty.dev/docs/config/ (and, more specifically, https://www.11ty.dev/docs/config/#input-directory).

In Eleventy, you have more flexibility with the directory structure. It will look in the input directory, which by default is the project's top level. For example, if you set /src as the input directory, you then can put the static files anywhere within there and refer to them as /path/to/filename.ext (_i.e._, rather than /src/path/to/filename.ext). For more details, see https://www.11ty.dev/docs/config/ (and, more specifically, https://www.11ty.dev/docs/config/#input-directory).

It works. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nilsmielke picture nilsmielke  路  4Comments

kaloja picture kaloja  路  3Comments

michrome picture michrome  路  3Comments

proog picture proog  路  3Comments

zellwk picture zellwk  路  3Comments