getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.48k stars 1.4k forks source link

[BLOG] - Assumption that /grav/ has no parent #561

Closed shaun-ba closed 8 years ago

shaun-ba commented 8 years ago

Hi,

Currently grav and its blog assumes that it will be run on a website on its own, without any parent site. If someone wants to use this as a standalone blog on an existing site there is issues with the directory/URL structure.

If grav is put under sub folder /blog/, the index of blog posts will show at domain.com/blog/, which is perfect, however articles then have the URL format domain.com/blog/blog/post

Can this be changed so the blog can be used on its own?

shaun-ba commented 8 years ago

There is a workaround to this provided to me by @flaviocopes

1) Rename user/pages/01.blog to 01.post 2) Change /config/system.yaml > Alias:home to "/post" 3) Change 01.post/blog.md to:

content: items: '@taxonomy': category: [blog]

The above will result in the URL structure domain.com/blog/post/lovely-post

rhukster commented 8 years ago

I actually have a fix for this.. maybe you can test it out:

https://github.com/getgrav/grav/tree/feature/hide_home_in_urls

shaun-ba commented 8 years ago

@rhukster Sorry for the long reply, yes i'm happy to test, is there an easy to to pull these changes into my grav skeleton?

shaun-ba commented 8 years ago

@rhukster thanks to the help of @flaviocopes i merged this with my user/ DIR and made the edits to configs to remove my /blog/post hack.

With this it works great as far as i can see.