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

Commit

Permalink
Adapt tests to also build with default locale in its own subfolder
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Chakroun committed Jun 5, 2020
1 parent e6e8232 commit 5f05a6e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ tmp
example/Gemfile.lock
example/_site
.DS_Store
.jekyll-cache
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ task :default => [:test]
desc "Run HTMLProofer"
task :test do
cd "example" do
sh "bundle exec jekyll clean"
sh "bundle exec jekyll build"
options = { empty_alt_ignore: true, enforce_https: true }
HTMLProofer.check_directory("./_site", options).run

sh "bundle exec jekyll clean"
sh "bundle exec jekyll build -c _config.yml,_config_default_locale_in_subfolder.yml"
HTMLProofer.check_directory("./_site", options).run
end
end
1 change: 1 addition & 0 deletions example/_config_default_locale_in_subfolder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_locale_in_subfolder: true
2 changes: 1 addition & 1 deletion example/_includes/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1 id="title">{{ page.title }}</h1>
<!-- Adds links to other languages on the post -->
{% for lang in site.languages %}
{% unless site.lang == lang %}
{% if lang == site.default_lang %}
{% if lang == site.default_lang and site.default_locale_in_subfolder != true %}
<a href="{{ site.baseurl_root }}{{ page.url }}" >{% t langs.{{ lang }} %}</a>
{% else %}
<a href="{{ site.baseurl_root }}/{{ lang }}{{ page.url }}" >{% t langs.{{ lang }} %}</a>
Expand Down
8 changes: 4 additions & 4 deletions example/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="site">
<div class="sidebar" id="sidebar">
<div class="header">
{% if site.lang == "it" %}
{% if site.lang == "it" and site.default_locale_in_subfolder != true %}
<h1 class="title"><a href="{{ site.baseurl_root }}/"><img id="logo" src="/images/logo.png"></a></h1>
{% else %}
<h1 class="title"><a href="{{ site.baseurl_root }}/{{ site.lang }}"><img id="logo" src="/images/logo.png"></a></h1>
Expand Down Expand Up @@ -64,9 +64,9 @@ <h1 class="title"><a href="{{ site.baseurl_root }}/{{ site.lang }}"><img id="log
</div>
{% tf footer.md %}
<br />
<a class="link-it" href="{{ site.baseurl_root }}/">it</a>
<a class="link-en" href="{{ site.baseurl_root }}/en">en</a>
<a class="link-es" href="{{ site.baseurl_root }}/es">es</a>
<a class="link-it" href="{% tl root it %}">it</a>
<a class="link-en" href="{% tl root en %}">en</a>
<a class="link-es" href="{% tl root es %}">es</a>
</div>

{{ content }}
Expand Down
3 changes: 3 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
layout: default
title: Home

namespace: root
permalink: /
---

{% assign page = site.posts.first %}
Expand Down
2 changes: 1 addition & 1 deletion example/pagination/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1 id="title">{{ title }}</h1>
<!-- Adds links to other languages on the post -->
{% for lang in site.languages %}
{% unless site.lang == lang %}
{% if lang == site.default_lang %}
{% if lang == site.default_lang and site.default_locale_in_subfolder != true %}
<a href="{{ site.baseurl_root }}{{ page.url }}" >{% t langs.{{ lang }} %}</a>
{% else %}
<a href="{{ site.baseurl_root }}/{{ lang }}{{ page.url }}" >{% t langs.{{ lang }} %}</a>
Expand Down

0 comments on commit 5f05a6e

Please sign in to comment.