Question

Setuping a staticMatic project using /index.html:

@slug = current_page.gsub(/\.html/, '')

returns "/index(.html)", but should be /index


Changing term corrects: - @slug = current_page.gsub("/", "").gsub(".html", "") as found in:

https://github.com/adamstac/staticmatic-bootstrap/blob/master/src/helpers/application_helper.rb

Was it helpful?

Solution

To delete the beginning "/" after you've stripped the html simply execute this (which will do both in one command):

current_page.gsub(/\.html/, '').gsub(/\//,''))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top