Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Hide the folder posts/content are in url

Started by Theodoros 9 years ago · 4 replies · 1068 views
9 years ago

Is the a way to have all my posts in a folder,and be able to access them without the folder name in the url?

Example (or look the pic)
site.com/posts/postidname (since postidname is in "posts" folder)
to be
site.com/postidname (but all file still be in posts folder.)

2017-12-07 20_37_41-Pages _ Grav|690x175

On my site http://embrancesblog.com/
if I just rhrow the files in th eroot,the menu is messed up. Any ideas how to fix this?

9 years ago

You can customize routes in configuration > Site and you can use something like this:

TXT
routes: 
     /posts/(.*): '/$1'
9 years ago

Tried it,doesnt work.2017-12-09 10_09_34-Configuration_ Site _ Embrance's Blog - I _3 Embrance! _)|690x122

The home part of the post url,isnt re-written as to not show.

9 years ago

Found anotrher way around it:
In the Configuration anable the option:
Hide home route in URLs

But I dont know still if with other folders it will work.

Suggested topics

Topic Participants Replies Views Activity
Support · by webmasterodp, 7 days ago
4 145 6 days ago
Support · by nwhitfield, 1 week ago
2 126 1 week ago
Support · by stell, 3 weeks ago
5 364 2 weeks ago
Support · by gravinator, 1 month ago
5 556 2 weeks ago
Support · by Gravver, 3 weeks ago
6 344 3 weeks ago