Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Change /posts/ URL? #1313

Open
jocap opened this issue Apr 14, 2019 · 2 comments
Open

Change /posts/ URL? #1313

jocap opened this issue Apr 14, 2019 · 2 comments

Comments

@jocap
Copy link

jocap commented Apr 14, 2019

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
Copy link
Author

jocap commented Apr 14, 2019

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
Copy link
Author

jocap commented Apr 14, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant