Nei*_*ton 6 ruby blogs middleman
我正在为我的网站使用Middleman Blog gem,但默认情况下,/source当看到vim中的树并尝试找到其中一个其他文件时,看起来需要找到博客文章并不是特别好看(例如一个模板).
通过查看文档,我无法看到是否有任何方式移动博客文章,以便将它们存储在其他位置,例如blog_articles文件夹或类似文件.
这可能吗?
cut*_*ine 11
将以下内容放在config.rb文件中.
activate :blog do |blog|
blog.permalink = ":year-:month-:day-:title.html"
blog.sources = "blog_articles/:title.html"
end
Run Code Online (Sandbox Code Playgroud)
假设您有一个帖子2012-01-01-example-article.html.markdown存储在该文件夹中source/blog_articles.
您现在应该看到带有此URL的帖子:http://localhost:4567/2012-01-01-example-article.html.(更改config.rb文件时可能需要重启中间人.)
请注意,我也必须设置blog.permalink,blog.sources单独的设置没有做到这一点.
奖金提示:我activate :directory_indexes在我的config.rb档案中.此设置为您提供外观漂亮的URL,没有该.html部分.如果您希望在博文中使用相同内容,则可以.html从blog.permalink设置中删除.像这样:
activate :blog do |blog|
blog.permalink = ":year-:month-:day-:title"
blog.sources = "blog_articles/:title.html"
end
Run Code Online (Sandbox Code Playgroud)
现在,您可以使用以下网址查看帖子:http://localhost:4567/2012-01-01-example-article.
| 归档时间: |
|
| 查看次数: |
2479 次 |
| 最近记录: |