Why Jekyll convert my Capital words into lowercase in Categories

若如初见. 提交于 2020-01-11 05:45:15

问题


graphics3d
word-cloud
math.se

This is my categories

Why they are all lowercase.

How can I make them into Uppercase, since my directores in my computers are Uppercases.

![enter image description here][1]

And my titles: WordList, Jekyll will convert it into Wordlist.

YML fronter:

---
layout: post
category: Mathematica//Math-Experiment
Tags: Formula Periodic Sequence
---

https://github.com/HyperGroups/hypergroups.github.com/blob/master/_posts/Mathematica/Math-Experiment/2013-09-11-Math_Experiment_Limit.html

Here you see, I wanna Mathematica becomes category not mathematica


回答1:


The following is my setup.

ruby 2.1.1p76
jekyll 1.0.2

I have the same problem, and eventually modified the following source file of jekyll. (I use "rvm")

# vim /usr/local/rvm/gems/ruby-2.1.1/gems/jekyll-1.0.2/lib/jekyll/post.rb

I removed the downcase method.

# diff post.rb.org post.rb
79c79
< self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.to_s.downcase}
---
> self.categories = self.data.pluralized_array('category', 'categories').map {|c| c.to_s}



回答2:


making it lowercase makes it easier for Jekyll to parse and handle the project.

I have a couple of questions for you:

  1. Is Jekyll's lower-casing of the category names hurting your site performance or causing you any trouble?
  2. Or do you want it for the aesthetics only?

If its the latter, the solution is to capitalize it back again.

{% for tag in page.categories %}
<a href="{{ site.url }}/categories/index.html#{{ page.categories | cgi_encode }}" data-toggle="tooltip" title="Other posts from the {{ tag | capitalize }} category" rel="tag">{{ tag | capitalize }}</a>
{% unless forloop.last %}&nbsp;&bull;&nbsp;
{% endunless %}
{% endfor %}


来源:https://stackoverflow.com/questions/19074064/why-jekyll-convert-my-capital-words-into-lowercase-in-categories

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!