Search code examples
jekyllliquidjekyll-extensions

Custom URL for assets folder in Jekyll


I currently have a Jekyll project with this structure:

├── _config.yml
├── assets
|   ├── js
|   ├── css
|   └── images

And my _config.yml looks like:

.
.
lang: en
destination: _site/en
.
.

So, when building the project all the site is inside the _site/en/ folder, this includes de assets folder with all my static assets (Images, css, js, etc).

Is there a way to build the page configuring a custom destination for the assets folder?

├── _config.yml
├── _site
|   ├── en
|   └── assets

I tried by adding this to my _config.yml (having installed jekyll-assets) without lucky:

assets:
  dirname: assets
  baseurl: /assets/
  sources:
    - assets

Solution

  • At the end, I'm building my site in several jekyll build executions. So, for me the simplest way of doing this is by excluding the assets folder for each language build and simply run a 'cp -a' of the assets folder to the _site/ folder. In this case, I avoid using another plugin and simply copy the files you need.