anchorcms/anchor-cms

Change /posts/ URL?

jocap opened this issue · 2 comments

jocap commented

Is there any way to change the /posts/ URL prefix, or remove it entirely? It doesn't fit with other languages than English.

I'd like this:

http://my.blog/posts/my-post

to become either one of these:

http://my.blog/my-post
http://my.blog/category/my-post

Any pointers?

jocap commented

Okay, so I figured out that the "posts page" setting (in Extend > Site Settings) lets you change it (if you first create another page manually), but it doesn't let you remove it, and it doesn't support more than one. I'd like to have /swedish/ and /english/, for example, but this seems impossible at the moment.

jocap commented

I've come up with a very hacky fix. It consists of a html_url function that I use in my theme:

function html_url($string) {
	return str_replace("/posts/", "/", $string) . ".html";
}

in combination with the following openbsd httpd configuration:

location match "/anchor/posts/?$" { block return 301 "/anchor" }
location match "/anchor/(.*)%.html" {
    request rewrite "/anchor/posts/%1"
}

which works, but it feels dirty.