File: index.html

package info (click to toggle)
ruby-jekyll-polyglot 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,196 kB
  • sloc: xml: 1,500; ruby: 947; sh: 10; makefile: 4
file content (417 lines) | stat: -rw-r--r-- 29,563 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
<!DOCTYPE html>
<html lang="en-us">

  <head>
  
  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="title" content="Home &middot; Polyglot">
  <meta name="description" content="크고 작은 블로그 모두가 빠르고 직관적인 다국어 지원을 가능케 하는 i18n 지원 Jekyll 플러그인.">
  <meta name="keywords" content="다국어, i18n, 제킬, 다국어, 빠른, 직관적인, untra, 깃허브, 페이지, 블로그, 플러그인, 루비, 젬, 국제화, 현지화, 번역, 언어, 지원, 다국어, 다국어">
  <meta http-equiv="Content-Language" content="ko">
<link rel="alternate" hreflang="en" href="https://polyglot.untra.io/"/>
<link rel="alternate" hreflang="es" href="https://polyglot.untra.io/es/"/>
<link rel="alternate" hreflang="de" href="https://polyglot.untra.io/de/"/>
<link rel="alternate" hreflang="fr" href="https://polyglot.untra.io/fr/"/>
<link rel="alternate" hreflang="ru" href="https://polyglot.untra.io/ru/"/>
<link rel="alternate" hreflang="nl" href="https://polyglot.untra.io/nl/"/>
<link rel="alternate" hreflang="he" href="https://polyglot.untra.io/he/"/>
<link rel="alternate" hreflang="ko" href="https://polyglot.untra.io/ko/"/>
<link rel="alternate" hreflang="zh-CN" href="https://polyglot.untra.io/zh-CN/"/>
<link rel="alternate" hreflang="pt-BR" href="https://polyglot.untra.io/pt-BR/"/>

  <title>
    
      Polyglot &middot; Straightforward I18n for Jekyll Blogs
    
  </title>

  <!-- CSS -->
  <link rel="stylesheet" href="/public/css/poole.css">
  <link rel="stylesheet" href="/public/css/syntax.css">
  <link rel="stylesheet" href="/public/css/hyde.css">
  <link rel="stylesheet" href="/public/css/custom.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">

  <!-- Icons -->
  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-144-precomposed.png">
                                 <link rel="shortcut icon" href="/public/favicon.ico">

  <!-- RSS -->
  <link rel="alternate" type="application/rss+xml" title="RSS" href="/ko/atom.xml">
</head>


  <body theme-base-08>

    
<div class="sidebar">
  <div class="container sidebar-sticky">
    <div class="sidebar-about">
      <p class="speech">안녕하세요!</p>
    </br>
      <h1>
        <a href="">
          Polyglot
        </a>
      </h1>
      <p class="lead"><a href="https://github.com/untra" target="_blank">@untra</a>가 만든, 크고 작은 블로그 모두가 빠르고 직관적인 다국어 지원을 가능케 하는 i18n 지원 <a href="http://jekyllrb.com" target="_blank">Jekyll</a> 플러그인.</p>
    </div>

    <nav class="sidebar-nav">
      <a class="sidebar-nav-item" href="/ko/">Home</a>

      
      
      
        
        
          
          
        
      
        
        
          
            <a class="sidebar-nav-item" href="/ko/about/">About</a>
          
          
        
      
        
        
          
            <a class="sidebar-nav-item" href="/ko/a-really-long-korean/permalink/">매우 긴 퍼마링크</a>
          
          
        
      
        
        
          
          
        
      
        
        
      
        
        
          
            <a class="sidebar-nav-item" href="/ko/sample/">Sample rich text data</a>
          
          
        
      
        
        
          
            <a class="sidebar-nav-item" href="/ko/seo/">SEO Recipes</a>
          
          
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
        
      
        
          
        
          
        
          
        
          
      <a class="sidebar-nav-item" href=""></a>

      <a class="sidebar-nav-item" href="https://rubygems.org/gems/jekyll-polyglot">Ruby Gem</a>
      <a class="sidebar-nav-item" href="https://github.com/untra/polyglot">GitHub project</a>
      <a class="sidebar-nav-item" href="https://github.com/untra/polyglot/tree/master/site/index.html"><small>view this page source on github</small></a>
      <small class="sidebar-nav-item">Currently v1.9.0</small>
    </nav>

    <p><small>&copy; 2025 Samuel Volin</small><br/><small>MIT Licensed</small></p>
<p>
  <!-- jekyll-polyglot will process ferh= into href= through the static_href liquid block tag without relativizing the url; useful for making language navigation switchers  -->
  
<a  href="/" >en</a> •
<a  href="/es/" >es</a> •
<a  href="/de/" >de</a> •
<a  href="/fr/" >fr</a> •
<a  href="/ru/" >ru</a> •
<a  href="/nl/" >nl</a> •
<a  href="/he/" >he</a> •
<a style="font-weight: bold;" href="/ko/" >ko</a> •
<a  href="/zh-CN/" >zh-CN</a> •
<a  href="/pt-BR/" >pt-BR</a>
</p>
  </div>
</div>


    <div class="content container">
      <div class="posts">
  
  <div class="post">
    <h1 class="post-title">
      <a href="/ko/2025/01/18/polyglot-1.9.0/">
        Polyglot 1.9.0 - Instructional Improvements
      </a>
    </h1>

    <span class="post-date">18 Jan 2025</span>

    <p>Jekyll-Polyglot 1.9.0 has been released, which has minor dependency updates, and instructional improvements for getting the most from your multi-language website.</p>

<h2 id="community-provided-instructional-improvements">Community provided instructional improvements</h2>

<p>Thank you to <strong><a href="https://github.com/aturret">aturret</a></strong> for helping to maintain the existing <code class="language-plaintext highlighter-rouge">zh-CN</code> site pages. 谢谢!</p>

<p><strong><a href="https://github.com/george-gca">george-gca</a></strong> improved the optional <code class="language-plaintext highlighter-rouge">derive_lang_from_path</code> configuration to better identify document language from the path inference. Tests were added for his helpful <a href="https://github.com/untra/polyglot/pull/222">feature improvement PR</a>. This improvement helps infer the language of posts and pages missing <code class="language-plaintext highlighter-rouge">lang</code> frontmatter, from any part of the document filepath.</p>

<p>Github user <strong><a href="https://github.com/yunseo-kim">yunseo-kim</a></strong> submitted a <a href="https://github.com/untra/polyglot/pull/230">instructions to improve sitemap generation</a> . To help with SEO, a website should have only one root sitemap.xml , and not have duplicates for each sub-language site. Be sure to add the <code class="language-plaintext highlighter-rouge">sitemap.xml</code> to the <code class="language-plaintext highlighter-rouge">exclude_from_localization</code> configuration.</p>

  </div>
  
  <div class="post">
    <h1 class="post-title">
      <a href="/ko/2024/08/18/polyglot-1.8.1/">
        Polyglot 1.8.1 - Community Bug Fixes Release
      </a>
    </h1>

    <span class="post-date">18 Aug 2024</span>

    <p>Jekyll-Polyglot 1.8.1이 출시되었습니다. 이번 릴리스에는 몇 가지 기능 개선 사항과 커뮤니티에서 발견된 버그 해결이 포함되어 있습니다.</p>

<h2 id="커뮤니티-제공-버그-수정">커뮤니티 제공 버그 수정</h2>

<p><strong><a href="https://github.com/hacketiwack">hacketiwack</a></strong>은 문서 퍼malink 설정을 위한 <a href="https://github.com/untra/polyglot/pull/200/files">보다 엄격한 검사</a>를 제공하여 빈 프런트매터 필드로 인한 하류 문제를 방지했습니다.</p>

<p>Github 사용자 <strong><a href="https://github.com/blackpill">blackpill</a></strong>은 기본 언어 링크 대체 href 렌더링 시 i18n 헤더 태그에 대한 <a href="https://github.com/untra/polyglot/pull/211/files">단일 문자 버그 수정</a>을 제출했습니다.</p>

  </div>
  
  <div class="post">
    <h1 class="post-title">
      <a href="/ko/2024/03/17/polyglot-1.8.0/">
        Polyglot 1.8.0 - 커뮤니티 제공물 릴리스
      </a>
    </h1>

    <span class="post-date">17 Mar 2024</span>

    <p>몇 가지 기능 향상과 커뮤니티 문서 및 기여를 인정하는 Jekyll-Polyglot 1.8.0에 대해 기대를 높이세요! 몇 가지 기능 향상과 커뮤니티 문서 및 기여를 인정하는 제킬-폴리글롯 1.8.0 에 대해 기대를 높이세요!</p>

<h2 id="언어별-고유-링크">언어별 고유 링크</h2>

<p>한 가지 새로운 기능은 페이지에 언어별 고유 링크를 제공하고 다른 상대 페이지와의 연결을 유지하는 것입니다. 이 새로운 기능은 또 다시 <strong><a href="https://github.com/antoniovazquezblanco">antoniovazquezblanco</a></strong> 에 의해 개선되었습니다, 진실된 신사이면서 학식 있는 분입니다.</p>

<h2 id="사이트맵-생성-및-다국어-seo">사이트맵 생성 및 다국어 SEO</h2>

<p>이 릴리스는 또한 품질을 인정합니다 <a href="https://polyglot.untra.io/sitemap.xml">sitemap.xml</a> 그리고 <a href="https://polyglot.untra.io/ko/robots.txt">robots.txt</a> solution provided by <strong><a href="https://github.com/jerturowetz">jerturowetz</a></strong>. 이 사이트는 이제 검색 엔진에 의해 정적 제킬 웹사이트로 크롤링될 수 있도록 이러한 설정을 사용하여 더 많은 SEO 기능을 보여주고 활용합니다. <a href="https://github.com/untra/polyglot/tree/master/site">여기</a> 예시 웹사이트 파일을 참조하십시오.</p>

<h2 id="jekyll-polyglot-post_write-hook">jekyll :polyglot :post_write hook</h2>

<p>Github 사용자  <strong><a href="https://github.com/obfusk">obfusk</a></strong> 몇 년 전 작은  <a href="https://github.com/untra/polyglot/pull/142">기여를 했습니다</a> 기여를 했습니다.</p>

<p>을 사용하여 polyglot <code class="language-plaintext highlighter-rouge">:site, :post_write</code> 이 기능은 각 자식 프로세스 실행 시 한 번 실행됩니다:</p>

<div class="language-rb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">Jekyll</span><span class="o">::</span><span class="no">Hooks</span><span class="p">.</span><span class="nf">register</span> <span class="ss">:site</span><span class="p">,</span> <span class="ss">:post_write</span> <span class="k">do</span> <span class="o">|</span><span class="n">site</span><span class="o">|</span>
  <span class="o">...</span>
<span class="k">end</span>
</code></pre></div></div>

<p>이 릴리스는 모든 언어가 처리된 후 정확히 한 번 실행되는 사용자 정의 후크 <code class="language-plaintext highlighter-rouge">:post_write</code> 를 추가합니다 (여부 <code class="language-plaintext highlighter-rouge">parallel_localization</code> 사용됩니다):</p>

<div class="language-rb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">Jekyll</span><span class="o">::</span><span class="no">Hooks</span><span class="p">.</span><span class="nf">register</span> <span class="ss">:polyglot</span><span class="p">,</span> <span class="ss">:post_write</span> <span class="k">do</span> <span class="o">|</span><span class="n">site</span><span class="o">|</span>
  <span class="c1"># 여기서 놀라운 것을 만들어 보세요!</span>
<span class="k">end</span>
</code></pre></div></div>

<p>이 기능은 추가적인 활용이 필요한 복잡한 제킬 정적 사이트에 유용합니다  <a href="https://jekyllrb.com/docs/plugins/hooks/">jekyll hook plugins</a>.</p>

<p>그녀는 또한 다음과 같은 문제를 해결하는 <a href="https://github.com/untra/polyglot/pull/145">언어 서브 프로세스 충돌 시 추가 로깅</a>. 이 기여에 감사합니다!</p>

<h2 id="지역-변수-및-포르투갈어-번역">지역 변수 및 포르투갈어 번역</h2>

<p><strong><a href="https://github.com/george-gca">george-gca</a></strong> 재능이 뛰어나고 멋진 분입니다, 그는 <a href="/ko/2024/02/29/localized-variables/">전체 블로그 게시물을 기고했습니다</a> 웹사이트 데이터에서 리치 텍스트를 가장 효과적으로 로컬라이징하는 방법에 대한. 그는 또한 제공했습니다 <a href="https://polyglot.untra.io/pt-BR/">브라질 포르투갈어 사이트 번역</a>.</p>


  </div>
  
  <div class="post">
    <h1 class="post-title">
      <a href="/ko/2024/02/29/localized-variables/">
        Localized variables
      </a>
    </h1>

    <span class="post-date">29 Feb 2024</span>

    <p>Polyglot allows you to have different pages for different languages in your Jekyll site. For example, one could have a page <code class="language-plaintext highlighter-rouge">about.md</code> in English and another <code class="language-plaintext highlighter-rouge">about.md</code> in Spanish with completely different layouts. But if you want to have the same layout for both pages, you can use localized variables. This is a way to have different data for different languages in your Jekyll site, but using the same layout for all languages.</p>

<p>As an example I will use a <a href="https://github.com/george-gca/multi-language-al-folio">template site</a> created with Polyglot.</p>

<h2 id="sharing-a-layout-between-pages">Sharing a layout between pages</h2>

<p>In that site they have an about page for every language, in their case english in <a href="https://github.com/george-gca/multi-language-al-folio/blob/main/_pages/en-us/about.md">_pages/en-us/about.md</a> and brazilian portuguese in <a href="https://github.com/george-gca/multi-language-al-folio/blob/main/_pages/pt-br/about.md">_pages/pt-br/about.md</a>. In both pages we can see that they have the same keys in the frontmatter, but some with different values. Both files point to the same <a href="https://jekyllrb.com/docs/layouts/">layout</a>, <a href="https://github.com/george-gca/multi-language-al-folio/blob/main/_layouts/about.liquid">about</a>, and this layout uses the values in the frontmatter to render the page.</p>

<p>For example, the <code class="language-plaintext highlighter-rouge">subtitle</code> key in the english page has the value <code class="language-plaintext highlighter-rouge">subtitle: &lt;a href='#'&gt;Affiliations&lt;/a&gt;. Address. Contacts. Moto. Etc.</code> and in the brazilian portuguese page it has <code class="language-plaintext highlighter-rouge">subtitle: &lt;a href='#'&gt;Afiliações&lt;/a&gt;. Endereço. Contatos. Lema. Etc.</code>. To use this information in the layout, it is used like this:</p>

<div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">{{</span><span class="w"> </span><span class="nv">page</span><span class="p">.</span><span class="nv">subtitle</span><span class="w"> </span><span class="cp">}}</span>
</code></pre></div></div>

<p>The same goes for the content below the frontmatter in both files, which is simply used in the layout like this:</p>

<div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">{{</span><span class="w"> </span><span class="nv">content</span><span class="w"> </span><span class="cp">}}</span>
</code></pre></div></div>

<p>Polyglot will automatically render the page with the correct values for the current language.</p>

<h2 id="sharing-a-layout-between-pages-with-localized-data">Sharing a layout between pages with localized data</h2>

<p>For the <code class="language-plaintext highlighter-rouge">subtitle</code> of the page they used <code class="language-plaintext highlighter-rouge">key: value</code> pairs in the frontmatter, but sometimes we want to use these same pairs in different parts of the site. For example, if we want to use the same <code class="language-plaintext highlighter-rouge">subtitle</code> in the <code class="language-plaintext highlighter-rouge">about.md</code> and in another page, we would have to repeat the same pair in the frontmatter of both pages. This is not ideal because if we want to change the <code class="language-plaintext highlighter-rouge">subtitle</code> we would have to change it in two places. This is where localized data comes in. You can create a file like <code class="language-plaintext highlighter-rouge">_data/:lang/strings.yml</code>, one for each language, and Polyglot will bring those keys under <code class="language-plaintext highlighter-rouge">site.data[:lang].strings</code>.</p>

<p>For example, in the template site there are two files, <a href="https://github.com/george-gca/multi-language-al-folio/blob/main/_data/en-us/strings.yml">_data/en-us/strings.yml</a> and <a href="https://github.com/george-gca/multi-language-al-folio/blob/main/_data/pt-br/strings.yml">_data/pt-br/strings.yml</a>. In the first file they have:</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">latest_posts</span><span class="pi">:</span> <span class="s">latest posts</span>
</code></pre></div></div>

<p>And in the second file they have:</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">latest_posts</span><span class="pi">:</span> <span class="s">últimas postagens</span>
</code></pre></div></div>

<p>This way, they can use the <code class="language-plaintext highlighter-rouge">latest_posts</code> key in the layout like this:</p>

<div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">{{</span><span class="w"> </span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">[</span><span class="nv">site</span><span class="p">.</span><span class="nv">active_lang</span><span class="p">].</span><span class="nv">strings</span><span class="p">.</span><span class="nv">latest_posts</span><span class="w"> </span><span class="cp">}}</span>
</code></pre></div></div>

<p>Which will correctly get the value for the <code class="language-plaintext highlighter-rouge">latest_posts</code> variable defined in the file <code class="language-plaintext highlighter-rouge">_data/:lang/strings.yml</code> for the current language.</p>

<h2 id="defining-which-variable-to-use-in-the-frontmatter">Defining which variable to use in the frontmatter</h2>

<p>Now if you want to define this variable in the frontmatter of the page, this gets a little bit trickier. One possible solution is to check if the value of the variable has a <code class="language-plaintext highlighter-rouge">.</code> in it, and if it does use the value in the file <code class="language-plaintext highlighter-rouge">_data/:lang/strings.yml</code>. This is how you would do it:</p>

<div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">{%</span><span class="w"> </span><span class="nt">if</span><span class="w"> </span><span class="nv">frontmatter_var</span><span class="w"> </span><span class="ow">contains</span><span class="w"> </span><span class="s1">'.'</span><span class="w"> </span><span class="cp">%}</span>
  <span class="cp">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">first_part</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">frontmatter_var</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">split</span><span class="p">:</span><span class="w"> </span><span class="s1">'.'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">first</span><span class="w"> </span><span class="cp">%}</span>
  <span class="cp">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">last_part</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">frontmatter_var</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">split</span><span class="p">:</span><span class="w"> </span><span class="s1">'.'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">last</span><span class="w"> </span><span class="cp">%}</span>
  <span class="cp">{%</span><span class="w"> </span><span class="nt">capture</span><span class="w"> </span><span class="nv">result</span><span class="w"> </span><span class="cp">%}{{</span><span class="w"> </span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">[</span><span class="nv">site</span><span class="p">.</span><span class="nv">active_lang</span><span class="p">].</span><span class="nv">strings</span><span class="p">[</span><span class="nv">first_part</span><span class="p">][</span><span class="nv">last_part</span><span class="p">]</span><span class="w"> </span><span class="cp">}}{%</span><span class="w"> </span><span class="nt">endcapture</span><span class="w"> </span><span class="cp">%}</span>
<span class="cp">{%</span><span class="w"> </span><span class="nt">endif</span><span class="w"> </span><span class="cp">%}</span>

<span class="cp">{{</span><span class="w"> </span><span class="nv">result</span><span class="w"> </span><span class="cp">}}</span>
</code></pre></div></div>

<p>This will work, for example, if <code class="language-plaintext highlighter-rouge">frontmatter_var = blog.title</code>.</p>

<p>Now, if you need to check if the localization string (in this case <code class="language-plaintext highlighter-rouge">blog.title</code>) actually exists in the file <code class="language-plaintext highlighter-rouge">_data/:lang/strings.yml</code> before using it, you’ll have to create a plugin to check if the variable exists in the file <code class="language-plaintext highlighter-rouge">_data/:lang/strings.yml</code> and if it does, use it, otherwise fallback to any value you want. I will not go into detail on how to do this, but I will show you how to use it. You can see the code for the plugin <a href="https://github.com/george-gca/multi-language-al-folio/blob/main/_plugins/localization-exists.rb">here</a>.</p>

<div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">{%</span><span class="w"> </span><span class="nt">if</span><span class="w"> </span><span class="nv">frontmatter_var</span><span class="w"> </span><span class="ow">contains</span><span class="w"> </span><span class="s1">'.'</span><span class="w"> </span><span class="cp">%}</span>
  <span class="cp">{%</span><span class="w"> </span><span class="nt">capture</span><span class="w"> </span><span class="nv">contains_localization</span><span class="w"> </span><span class="cp">%}{%</span><span class="w"> </span><span class="nt">localization_exists</span><span class="w"> </span><span class="cp">{{</span><span class="w"> </span><span class="nv">frontmatter_var</span><span class="w"> </span><span class="cp">}}</span><span class="w"> </span><span class="cp">%}{%</span><span class="w"> </span><span class="nt">endcapture</span><span class="w"> </span><span class="cp">%}</span>
  <span class="cp">{%</span><span class="w"> </span><span class="nt">if</span><span class="w"> </span><span class="nv">contains_localization</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s1">'true'</span><span class="w"> </span><span class="cp">%}</span>
    <span class="cp">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">first_part</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">frontmatter_var</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">split</span><span class="p">:</span><span class="w"> </span><span class="s1">'.'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">first</span><span class="w"> </span><span class="cp">%}</span>
    <span class="cp">{%</span><span class="w"> </span><span class="nt">assign</span><span class="w"> </span><span class="nv">last_part</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nv">frontmatter_var</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">split</span><span class="p">:</span><span class="w"> </span><span class="s1">'.'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">last</span><span class="w"> </span><span class="cp">%}</span>
    <span class="cp">{%</span><span class="w"> </span><span class="nt">capture</span><span class="w"> </span><span class="nv">result</span><span class="w"> </span><span class="cp">%}{{</span><span class="w"> </span><span class="nv">site</span><span class="p">.</span><span class="nv">data</span><span class="p">[</span><span class="nv">site</span><span class="p">.</span><span class="nv">active_lang</span><span class="p">].</span><span class="nv">strings</span><span class="p">[</span><span class="nv">first_part</span><span class="p">][</span><span class="nv">last_part</span><span class="p">]</span><span class="w"> </span><span class="cp">}}{%</span><span class="w"> </span><span class="nt">endcapture</span><span class="w"> </span><span class="cp">%}</span>
  <span class="cp">{%</span><span class="w"> </span><span class="nt">else</span><span class="w"> </span><span class="cp">%}</span>
    <span class="cp">{%</span><span class="w"> </span><span class="nt">capture</span><span class="w"> </span><span class="nv">result</span><span class="w"> </span><span class="cp">%}</span>fallback value<span class="cp">{%</span><span class="w"> </span><span class="nt">endcapture</span><span class="w"> </span><span class="cp">%}</span>
  <span class="cp">{%</span><span class="w"> </span><span class="nt">endif</span><span class="w"> </span><span class="cp">%}</span>
<span class="cp">{%</span><span class="w"> </span><span class="nt">endif</span><span class="w"> </span><span class="cp">%}</span>

<span class="cp">{{</span><span class="w"> </span><span class="nv">result</span><span class="w"> </span><span class="cp">}}</span>
</code></pre></div></div>

  </div>
  
  <div class="post">
    <h1 class="post-title">
      <a href="/ko/2023/10/29/polyglot-1.7.0/">
        Polyglot 1.7.0 and page_id front-matter for different permalinks by language
      </a>
    </h1>

    <span class="post-date">29 Oct 2023</span>

    <p>I’m excited to announce Jekyll-Polyglot 1.7.0, which has a new feature to give pages language specific permalinks and to retain their association to other relative pages.</p>

<p>This new feature is provided by <strong><a href="https://github.com/antoniovazquezblanco">antoniovazquezblanco</a></strong>, who is a gentleman and a scholar.</p>

<h2 id="use-page_id-frontmatter-to-associate-pages-with-different-permalinks">use <code class="language-plaintext highlighter-rouge">page_id</code> frontmatter to associate pages with different permalinks</h2>

<p>Polyglot associates pages by matching their permalinks or filenames.
However some site translations may instead desire pages with unique permalinks.</p>

<p>Polyglot already coordinates multiple copes of the same document across different languages. So keying off of a different property like <code class="language-plaintext highlighter-rouge">page_id</code> is no different than keying off of the permalink.</p>

<p>Using a <code class="language-plaintext highlighter-rouge">page_id</code> to coordinate similar pages with different permalinks ensures that custom permalinks can still be seen on language specific sites.</p>

<h3 id="redirects-for-unique-permalinks">redirects for unique permalinks</h3>

<p>The challenge with unique permalinks comes with relativizing those urls. Polyglot avoids this problem entirely by suggesting consistent permalinks.</p>

<p>To help with this, polyglot sets <code class="language-plaintext highlighter-rouge">redirect_from</code> hidden frontmatter on these pages, listing the unique permalinks of corresponding pages.</p>

<p>When using the <code class="language-plaintext highlighter-rouge">jekyll-redirect-from</code> plugin, that frontmatter will be picked up, and intelligent redirects made to the page’s custom permalink.</p>

<p>To see this in action, visit <a href="/ko/a-really-long/permalink/">this page with a long permalink in different languages</a>.</p>

<h2 id="other-bug-fixes">Other bug fixes</h2>

<ul>
  <li>This release should have a fix for <a href="https://github.com/untra/polyglot/issues/151">#151</a> and <a href="https://github.com/untra/polyglot/issues/184">#184</a>, preventing crashes on startup when calling other jekyll commands.</li>
</ul>

  </div>
  
</div>

<div class="pagination">
  
    <a class="pagination-item older" href="/ko/page2">Older</a>
  
  
    <span class="pagination-item newer">Newer</span>
  
</div>

    </div>

  </body>
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-HWC3D32MT8"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
  
    gtag('config', 'G-HWC3D32MT8');
  </script>
</html>