使用staticMatic设置/index.html项目:
@slug = current_page.gsub(/\.html/, '')
返回"/index(.html)",但应该是/index
更改术语更正:- @slug = current_page.gsub("/", "").gsub(".html", ""),如以下所示:
https://github.com/adamstac/staticmatic-bootstrap/blob/master/src/helpers/application_helper.rb
发布于 2010-08-08 22:13:58
要删除开头的"/“,在去掉html之后,只需执行以下操作(这将在一个命令中同时执行):
current_page.gsub(/\.html/, '').gsub(/\//,''))https://stackoverflow.com/questions/3436274
复制相似问题