jekyll-theme-centos 2.52.0.beta.12 → 2.52.0.beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b23bb42f2a85f4ea35fd982f65b2aa73640b710a47490e4034afe6365c053c88
4
- data.tar.gz: 50b544b9b5d60d38b3ad79c2f869fd28460198daa210d52129dbb0f70125cc70
3
+ metadata.gz: 45cadfca5935e156a7e744c0040a7ab88d00f181c42b4cfd1a7e2d2edb4e0242
4
+ data.tar.gz: d65f9a18ca1772cf59166e6efa0136d70d3e43dda7783e9f99a32136c6587df9
5
5
  SHA512:
6
- metadata.gz: f79b2ed99c36f5fd4e722c4ec37fb5482d8cb22794a82d15ce8fd2901bc03e6d5119662ddbd5c2e692fcca1e1902ae63c38f228cc8c8bf2f846552ba5bd4e776
7
- data.tar.gz: a42aa83c4e352b60aaa2e5f70ed7f84da098c0980f535577ea4a66358cd0d9162d6045d5032ba55fcf8cadcb20f0d36d0469828e8a32bf1f0de727c5e9e56799
6
+ metadata.gz: b2eae17b555b20acf162c46e6f5fce137f79df191699444b20c542ee142b435d49143424cc98ba2ba0acf2fac614428f711f14f1304559b163da63a8137eda35
7
+ data.tar.gz: 37490f38ef21de11de52a0418a729882c8fb0277c46db77e20a503452bc611f2d34a3236d411ec24053086fc9f36f8ec71fc87a63d3b80413d98154cc73d8052
@@ -1,41 +1,66 @@
1
1
  {% comment %}
2
2
  ================================================================================
3
3
  Template: Language Selector (Locales Dropdown)
4
- Purpose: Renders dropdown menu for language/locale selection. Generates links
5
- to same page in different language versions.
4
+ Purpose: Renders dropdown menu for language/locale selection with current
5
+ language detection and visual indicators. Generates links to same page in
6
+ different language versions.
6
7
  ================================================================================
7
8
 
8
- Design Logic:
9
- - Bootstrap dropdown: consistent UI pattern
10
- - Language lookup: uses site.data.base.languages mapping
11
- - URL construction: locale prefix + page URL
12
- - Current language: defaults to English
13
- - Icon: language globe icon from Font Awesome
9
+ Configuration: Reads from unified `with_locales_data` schema via Jekyll defaults.
10
+ - Enable with: with_locales: true in _config.yml defaults or page front matter
11
+ - Locales defined in: with_locales_data.locales
12
+ - Uses site.data.base.languages for language name lookups
13
+ - Automatically detects current page locale and highlights in menu
14
+ - Always includes English (en) even if not in locales list
14
15
 
15
- Required Inputs:
16
- - [array]: List of locale codes (e.g., ["es", "fr", "de"])
16
+ Features:
17
+ - Displays current language name in button with locale code
18
+ - Shows all available languages in dropdown (including English)
19
+ - Shows checkmark next to current language in dropdown
20
+ - Marks current language link with active class
21
+ - Displays language code in parentheses (e.g., "Español (es)")
17
22
 
18
- Optional Inputs:
19
- - data: Locales array (overrides all fallbacks)
20
-
21
- Data Source Hierarchy (priority):
22
- 1. include.data
23
- 2. page.with_locales_data
24
- 3. site.data.locales
25
- 4. site.data.base.locales
23
+ Locale Detection:
24
+ - page.data['locale'] is set by localization_gettext.rb plugin in LocalizedPage.setup_localized_data()
25
+ - Set for each localized page variant (e.g., /es/ pages have locale='es')
26
+ - Defaults to 'en' if not set (English/canonical pages)
26
27
  ================================================================================
27
28
  {% endcomment %}
28
29
 
29
- {%- assign locales = include.data | default: page.with_locales_data | default: site.data.locales | default: site.data.base.locales %}
30
+ {%- assign configured_locales = page.with_locales_data.locales | default: empty_array %}
31
+
32
+ {%- comment %} Build array of all available locales (always include English) {%- endcomment %}
33
+ {%- assign all_locales = configured_locales | default: empty_array %}
34
+ {%- unless all_locales contains "en" %}
35
+ {%- assign all_locales = all_locales | unshift: "en" %}
36
+ {%- endunless %}
37
+
38
+ {%- comment %} Detect current page locale from URL: /es/..., /fr/..., etc. {%- endcomment %}
39
+ {%- assign url_parts = page.url | split: "/" %}
40
+ {%- assign current_locale = "en" %}
41
+ {%- if url_parts[1] and all_locales contains url_parts[1] %}
42
+ {%- assign current_locale = url_parts[1] %}
43
+ {%- endif %}
44
+
45
+ {%- if page.with_locales and configured_locales %}
30
46
 
31
- {%- comment %} === Presentation === {% endcomment %}
32
47
  <div class="dropdown">
33
48
  <button class="btn btn-sm btn-outline-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Languages">
34
- <i class="fa-solid fa-language"></i> {{ site.data.base.languages["en"] }}
49
+ <i class="fa-solid fa-language me-1"></i> {{ site.data.base.languages[current_locale] }} ({{ current_locale }})
35
50
  </button>
36
51
  <ul class="dropdown-menu">
37
- {% for locale in locales %}
38
- <li><a class="dropdown-item" href="{{ site.baseurl }}/{{ locale }}{{ page.url }}">{{ site.data.base.languages[locale] }}</a></li>
39
- {% endfor %}
52
+ {%- for locale in all_locales %}
53
+ {%- comment %} DEBUG: page.url={{ page.url }}, current_locale={{ current_locale }}, target_locale={{ locale }} {%- endcomment %}
54
+ {%- assign locale_url = page.url | switch_locale_url: locale %}
55
+
56
+ {%- if locale == current_locale %}
57
+ <li class="small"><a class="dropdown-item active" href="{{ site.baseurl }}{{ locale_url }}" aria-current="true">
58
+ {{ site.data.base.languages[locale] }} ({{ locale }}) <i class="fa-solid fa-check ms-3"></i>
59
+ </a></li>
60
+ {%- else %}
61
+ <li class="small"><a class="dropdown-item" href="{{ site.baseurl }}{{ locale_url }}">{{ site.data.base.languages[locale] }} ({{ locale }})</a></li>
62
+ {%- endif %}
63
+ {%- endfor %}
40
64
  </ul>
41
65
  </div>
66
+ {%- endif %}
@@ -3,10 +3,12 @@
3
3
  Template: Navigation Index Component
4
4
  Purpose: Renders a collection of pages or components in multiple display formats.
5
5
  Provides flexible list/card/table views for indexes and inventories.
6
+ Automatically filters data by current page locale to avoid duplicates.
6
7
  ================================================================================
7
8
 
8
9
  Design Logic:
9
10
  - Multi-format output: card, text, list, table, component_table (default: list)
11
+ - Filters data by locale: shows canonical pages for English, localized variants for other locales
10
12
  - Filters out current page from results (prevents self-linking)
11
13
  - Reusable link component for consistent styling
12
14
  - Optional filename display using page name (with .md stripped)
@@ -23,12 +25,36 @@ Optional Inputs:
23
25
  Data Object Properties:
24
26
  - name, title, url, title_lead: Common properties
25
27
  - component.name: Component identifier (for component_table format)
28
+ - locale: Locale code for localized pages (set by localization plugin)
26
29
  ================================================================================
27
30
  {% endcomment %}
28
31
 
29
32
  {% assign data = include.data | default: nil %}
30
33
  {% assign format = include.format | default: "list" %}
31
34
 
35
+ {%- comment %} Filter data by locale to show only matching language pages {%- endcomment %}
36
+ {%- assign current_locale = page.locale | default: 'en' %}
37
+ {%- assign filtered_data = '' | split: '' %}
38
+
39
+ {%- for item in data %}
40
+ {%- assign item_locale = item.locale | default: 'en' %}
41
+
42
+ {%- if current_locale == 'en' %}
43
+ {%- comment %} For English pages, show only canonical pages (not localized variants) {%- endcomment %}
44
+ {%- if item.localized != true %}
45
+ {%- assign filtered_data = filtered_data | push: item %}
46
+ {%- endif %}
47
+ {%- else %}
48
+ {%- comment %} For localized pages, show only pages matching current locale {%- endcomment %}
49
+ {%- if item_locale == current_locale %}
50
+ {%- assign filtered_data = filtered_data | push: item %}
51
+ {%- endif %}
52
+ {%- endif %}
53
+ {%- endfor %}
54
+
55
+ {%- comment %} Use filtered data for rendering {%- endcomment %}
56
+ {%- assign data = filtered_data %}
57
+
32
58
  {% capture card %}
33
59
  {% assign show_page_filename = include.show_page_filename | default: "false" %}
34
60
  <div class="row g-3 mb-3 pt-1">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-centos
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.52.0.beta.12
4
+ version: 2.52.0.beta.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - ReleaseBot