Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

.htaccess cannot be included #185

Open
Clpsplug opened this issue Jan 21, 2021 · 3 comments
Open

.htaccess cannot be included #185

Clpsplug opened this issue Jan 21, 2021 · 3 comments

Comments

@Clpsplug
Copy link

This may be related to #47.

Summary

It seems that include: ['.htaccess'] in config.yml is negated by this plugin.

Environment

gem "jekyll", "~> 4.1.1"
group :jekyll_plugins do
  gem 'jekyll-multiple-languages-plugin'
end

Steps to reproduce

  1. Create a Jekyll website
  2. Add this plugin
  3. in config.yml, write include: ['.htaccess']
  4. Create .htaccess (its content doesn't really matter)
  5. Run jekyll serve or jekyll build

The BUG behavior

.htaccess file cannot be found anywhere in the _site directory.

The expected behavior

.htaccess file appears in the root of the _site directory.

Notes

We have this line in the current version (1.7.0:)
3d9d64e

which fixed #47.
However, maybe because of this line, I'm not getting my .htaccess file to show up anywhere in the _site folder like it was not explicitly included outright.
The commit message says that this line should take effect after the pages for the base language are constructed (hence the expected behavior,) but it's not doing that.

Currently, I have to manually copy the .htaccess file, which is already causing deployment mistakes here and there. Issue #47 is for Jekyll 2.x, so it's possible that the internal working of Jekyll changed across major versions.

@staffler-xyz
Copy link

I have the same issue. Last working version was 1.6.1

@Clpsplug
Copy link
Author

Clpsplug commented Jul 5, 2022

I found a workaround. Use the keep_files directive in _config.yaml.
Usually, Jekyll wipes the _site directory (the output directory) clean before each build. This key will tell Jekyll to leave the specified files in the output-dir intact.

So you want to write this in your _config.yaml...:

keep_files:
  - .htaccess

...and either:

  1. put your .htaccess in your _site directory or
  2. put your .htaccess somewhere else, and symlink it to _site/.htaccess.

@figgles
Copy link
Contributor

figgles commented Aug 3, 2023

The code explicitly removes this file probably because it would be duplicated in each translated site page:

      # Remove .htaccess file from included files, so it wont show up on translations folders.
      self.include -= [".htaccess"]

This solution doesn't seem ideal though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants