htmly icon indicating copy to clipboard operation
htmly copied to clipboard

Custom permalink

Open elpsykongroo opened this issue 9 years ago • 12 comments

How can I change www.example.com/post/title to www.example.com/books/title or remove /post completely? I could change it in WordPress but HTMLy doesn't seem to have such option?

elpsykongroo avatar Feb 10 '16 04:02 elpsykongroo

Current htmly only support www.example.com/post/title and www.example.com/year/month/title but perhaps it will support more custom URLs later.

danpros avatar Feb 10 '16 05:02 danpros

www.example.com/%postname% and www.example.com/%category%/%postname% options would be great. I can't port my websites to HTMLy without these. I tried editing HTMLy core files and managed to change /post but when loading post it gives me error 404 page not found.

elpsykongroo avatar Feb 13 '16 17:02 elpsykongroo

After studying PHP for 5 days I finally managed to change /post into %category%. For someone who is good with PHP I imagine such feature would be pretty easy to implement into the core.

elpsykongroo avatar Feb 16 '16 03:02 elpsykongroo

@elpsykongroo did you use example:

get('/:category/:name', function ($category, $name)

danpros avatar Feb 16 '16 04:02 danpros

@danpros Yes, edited a couple lines in htmly.php, functions.php, admin.php and edit.content.html.php. Tested and everything seems to work great.

elpsykongroo avatar Feb 16 '16 05:02 elpsykongroo

Also I don't want /category slug to appear in category url so I removed it from get('/category/:category', function ($category), but then sitemap doesn't work because of it. Any idea how to make it work?

elpsykongroo avatar Feb 17 '16 01:02 elpsykongroo

This is custom modification so I don't support it, the best solutions is you make pull request with your current modification but you should adding more value instead of just changing existing core. Let say creating an options to switch to another slug type etc.

Example new valuable addition:

www.example.com/%category%/%postname%

Edit: You can contact me directly if you want to discuss it further.

danpros avatar Feb 20 '16 01:02 danpros

I tried to do the same (example.com/%category%/%postname%), unfortunately i get error 500. Could you please give a detailed instruction which lines of files need to be replaced, and the text to replace. thank you in advance.

This is a very useful option, sorry, it would be fine if it went into the kernel in the future.

achadidi avatar Jul 22 '17 21:07 achadidi

@achadidi im looking for solution to remove dates from post slug. Can You help me with? Or give hint?

ghost avatar Jul 25 '18 09:07 ghost

I was wanting to do the same thing as the original poster. Hopefully this gets added in the near future. It would be good for SEO. I'm going to dig around in the code and see if I can get it working myself. I'll share my efforts if I succeed.

nomadevs avatar Dec 07 '20 01:12 nomadevs

Hello, Can someone (@achadidi ?) explain what to edit to remove /post/ from url ? I manage to make it work only to make it also impossible to login/logout again. Any help would be greatly appreciated. thank you

supercharlez avatar Sep 18 '21 12:09 supercharlez

+1

graphixela avatar May 13 '22 00:05 graphixela

I'm newbie with HTMLy, btw great blogtool :) I want to change the url ../post/my_post/ to ../bericht/my_post/ Found the code in system/admin.php, but when change manually, after update it override the code. Some news when the option custom permalinks added?

Screenshot 2022-11-25 13 34 50

ctuxboy avatar Nov 25 '22 12:11 ctuxboy

This issue is too old, I will close this one. Please create new issue for possible improvements. Thanks

danpros avatar Jan 07 '24 07:01 danpros