使用设置staticMatic项目 /index.html :
/index.html
@slug = current_page.gsub(/\.html/, '')
"/index(.html)" ,但应该是 /index
"/index(.html)"
/index
@slug = current_page.gsub("/", "").gsub(".html", "") 见:
@slug = current_page.gsub("/", "").gsub(".html", "")
https://github.com/adamstac/staticmatic-bootstrap/blob/master/src/helpers/application_helper.rb
要在剥离html后删除开头“/”,只需执行以下命令(这将在一个命令中同时执行):
current_page.gsub(/\.html/, '').gsub(/\//,''))