Closed hynrng closed 1 month ago
Hello @hynrng 👋
The problem is .github
in the exclude_from_localization
configuration. That is used to build a regex and the .
in a directory name is likely not handled well.
However that exclude_from_localization
setting is for specifying directories you want included only once in your built jekyll site, and not localized for N many languages (["en", "ko"]
).
You should instead specify the .github
directory as part of the exclude: [...]
configuration for jekyll if you specifically want that directory excluded from the built site, which is what I think you want.
I hope this helps and makes sense!
Thank you for your detailed response.
However, although I read your response carefully, I am still under the same problem.
My understanding is that need to add .github
to the exclude:
part of _config.yml
, but I'm still getting the same error.
I'm sorry, but could you help me a little more? I would really like to try this plugin.
my _config.yml
is currently like:
exclude:
...
- .github # jekyll-polyglot
looking closer, when I run the regex in your error
/href="?\/((?:(?!*.gem)(?!*.gemspec)(?!docs)(?!tools)
(?!README.md)(?!LICENSE)(?!*.config.js)(?!package*.json)(?!.sass-cache)(?!.jekyll-cache)(?!gemfiles)(?!Gemfile)
(?!Gemfile.lock)(?!node_modules)(?!vendor\/bundle\/)(?!vendor\/cache\/)(?!vendor\/gems\/)(?!vendor\/ruby\/)
(?!_data\/)(?!_includes\/)(?!_plugins\/)(?!_sass\/)(?!_tabs\/)(?!.github\/)(?!assets\/)(?!en\/)
(?!ko\/)[^,'"\s\/?.]+\.?)*(?:\/[^\]\[)("'\s]*)?)"/
through regexr I see it highlights the *.gem
and *.gemspec
that you took out. It also flags *.config.js
which I don't see you mentioned anywhere in your config, but that value is being included and problematic to the built regex. Try taking that out wherever you may have specified it:
Uh, sorry, I forgot to mention that.
I'm using Chirpy theme and by default, the _config.yml
of it excludes:
- "*.gem"
- "*.gemspec"
- docs
- tools
- README.md
- LICENSE
- "*.config.js"
- package*.json
and I guess those with the wildcard are causing the problem. I tried to take them out, and sure enough, the page builds without 'relative_url_regex': target of repeat operator is not specified
error, but it ends up being broken like: "Index of ..."
I would say that this is a bug in the chirpy theme: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/_config.yml#L211-L217
exclude entries are supposed to be file or directory names, not glob patterns. https://jekyllrb.com/docs/configuration/options/#global-configuration
either the jekyll documentation is wrong, or chirpy theme excludes are not working correctly. I would open a bug in that project and ask about this.
Thank you for your sincere response.
There doesn't seem to be much I can do on my own. It's unfortunate, but I'd better to wait for the issue to be resolved 🥲
I discovered other jekyll themes such as miminal-mistakes are using flob patterns on exlude:
section.
So, rather than opening an issue on Chirpy theme, I edited the site.rb
code like:
relative_url_regex
def relative_url_regex(disabled = false)
regex = ''
unless disabled
@exclude.each do |x|
escaped_x = Regexp.escape(x)
regex += "(?!#{escaped_x})"
end
@languages.each do |x|
escaped_x = Regexp.escape(x)
regex += "(?!#{escaped_x}\/)"
end
end
start = disabled ? 'ferh' : 'href'
%r{#{start}="?#{@baseurl}/((?:#{regex}[^,'"\s/?.]+\.?)*(?:/[^\]\[)("'\s]*)?)"}
end
absolute_url_regex()
def absolute_url_regex(url, disabled = false)
regex = ''
unless disabled
@exclude.each do |x|
escaped_x = Regexp.escape(x)
regex += "(?!#{escaped_x})"
end
@languages.each do |x|
escaped_x = Regexp.escape(x)
regex += "(?!#{escaped_x}\/)"
end
end
start = disabled ? 'ferh' : 'href'
%r{(?<!hreflang="#{@default_lang}" )#{start}="?#{url}#{@baseurl}/((?:#{regex}[^,'"\s/?.]+\.?)*(?:/[^\]\[)("'\s]*)?)"}
end
and now it works fine. If someone is having the same situation as me, I hope these solutions will help, although it might not a fundamental solution.
Hello, thank you for a great plugin. I would love to try this plugin for my Jekyll blog.
However unfortunately I'm facing the following error:
It seems the following code is causing the error,
However I don't think fixing the code would help.
for the information, my
_config.yml
file is like:I've followed the another issue seems related with my situation (removing ".gem" and ".gemspec" from
_config.yml
) but it didn't help. (I'm using Ruby 3.3.0, jekyll 4.3.3, and working on Windows.)