2017-09-07 7 views
0

최신 Jekyll을 사용하여 octopress-multilingual 및 octopress-paginate를 모두 통합하려고합니다. 그리고 이것은 제대로 작동하지 않습니다.octopress-paginate가있는 Octopress - 다국어는 최신 지킬과 호환되지 않습니다.

이 경우 octopress-paginate를 사용하여 번역 된 지켈 페이지를 페이지 매김 할 수 없습니다.

내가 달성하고자하는 것은 _config.yml 파일에 정의 된 전역 변수를 기반으로하는 페이지 매김을 허용하기 위해 _plugin 폴더에 .rb 파일을 저장하는 것입니다. 이것은 ruby ​​메쏘드 alias_method를 사용하여 현재의 행동을 덮어 쓰고 있습니다. _pages의 /의 news.html (추출물)

--- 
layout: default 
title: news 
permalink: /latest/news/ 
paginate: 
    collection: posts 
    per_page:  4      # maximum number of items per page 
    limit:  false 
    permalink: :num/ # pagination path (relative to template page) 
--- 
<!-- Page code goes here--> 
{% assign news = paginator.posts | where:'category', 'articles' | where:'lang', site.lang %} 
{% for post in news %} 
<!-- News code goes here--> 
{% endfor %} 
<!-- Page code goes here--> 
{% for page in (1..paginator.total_pages) %} 
<!-- Paginator code goes here--> 
{% endfor %} 
<!-- Page code goes here--> 
:

_config.yml (추출물)

lang: en 

_plugins/.yml (추출물)

module Octopress 
    module Paginate 
    def paginate(page) 
     defaults = DEFAULT.merge(page.site.config['pagination'] || {}) 
     if page.data['paginate'].is_a? Hash 
     page.data['paginate'] = defaults.merge(page.data['paginate']) 
     else 
     page.data['paginate'] = defaults 
     end 
     if tag = Jekyll.configuration({})['lang'] 
     page.data['paginate']['tags'] = Array(tag) 
     end 
     if category = page.data['paginate']['category'] 
     page.data['paginate']['categories'] = Array(category) 
     end 
     old_paginate(page) 
    end 
    alias_method :old_paginate, :paginate 
    end 
end 

이 내 레이아웃입니다

위의 예에서 언어별로 게시물을 필터링하고 있지만 페이징 처리자는 언어별로 필터링하지 않습니다. .

목표는 _config.yml 파일의 lang 태그를 기반으로 게시물에 페이지 매김을 할 수있게하는 것입니다.

이것이 가능합니까?

+0

[Octopress] (https://github.com/octopress/octopress)는 죽은 프로젝트처럼 보입니다. 1 년 반 동안은 아무 일도 일어나지 않았고 가장 최근 버전은 완전히 양조되지 않았습니다. 작은 일들이 제대로 작동하지 않는 경우가 많습니다 .- ( – axiac

+0

그래, 아마도 그렇게 할 수는 있겠지만 적어도 가능해야한다. 맞습니까? – ccamacho

답변