我正在开发一个插件来促进多语言 Jekyll 网站,作为其中的一部分,我必须根据他们的语言对帖子进行分类。
我正在尝试根据其语言标记帖子,因此我覆盖了该aggregate_post_info
方法,但是当我打印site.tags
变量时,它是空的。
module Jekyll
class Site
alias_method :_aggregate_post_info, :aggregate_post_info
def aggregate_post_info(post)
_aggregate_post_info(post)
@tags[post.data['lang']] << post
end
end
end