【问题标题】:Octopress capitalization in new posts新帖子中的 Octopress 大写字母
【发布时间】:2013-02-02 15:18:47
【问题描述】:

今天我更新了我的 Octopress 博客,当我运行时:

rake new_post["This is a test of title"]

它在 source/_post/2013-02-18-this-is-a-test-of-title.markdown 中创建我的降价文件,然后我运行:

rake generate

rake preview

帖子现在有了标题

This Is A Test Of Title

我查看了降价的来源并发现

...
title: "This is a test of title"
...

所以降价很好。同样在网页中,我使用 Chrome 的开发人员工具来查看 css 属性是否具有“capitalize”的值,但它没有,锚看起来像这样

<a href="...">This Is A Test of Title</a>

看来大写的问题来自框架。

在 imathis/octopress repostory https://github.com/imathis/octopress/issues/202 的 wiki 中,似乎有些用其他语言发帖的人不喜欢这个“功能”,甚至在 Rakefile 中,imathis 也删除了这一行:

post.puts "title: \"#{title.gsub(/&/,'&amp;').titlecase}\""

对于这个:

post.puts "title: \"#{title.gsub(/&/,'&amp;')}\""

对于那个提交,所以我打开了我的 Rakefile,它有最后一行,所以我的文件是最新的,但显然问题仍然存在

知道如何避免在帖子标题中出现这种行为吗?

【问题讨论】:

    标签: markdown jekyll octopress


    【解决方案1】:

    在您的 _config.yml 中,找到该行

    titlecase: true       # Converts page and post titles to titlecase
    

    并将其设置为 false。

    有关titlecase 的更多信息。您也可以查看plugins/titlecase.rb 以了解其工作原理。

    【讨论】:

    • 这解决了问题,我没有找到它,因为我假设我“知道”我可以在我的 '_config.yml' 中找到什么,但这显然有效
    猜你喜欢
    • 2021-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-24
    • 2017-08-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多