-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Friendly URLs instead of IDs #330
Comments
What happens in case of name collision? |
Exactly. Albums and photos in Lychee don't need to have unique titles. We could, of course, add code to enforce that they be unique, but still... I think the easiest way for us to implement something like this would be to add an |
I would like to also bring up the attention with a possible collision with the (not released yet) page module. :) |
Erm, what is the page module? 😃 |
Well I guess you were not aware that you could add pages & menu to the landing. 😆 Route::get('/{page}', 'PageController@page'); public function page(Request $request, $page)
{
$page = Page::enabled()->where('link', '/' . $page)->first();
if ($page == null) {
abort(404);
}
$lang = Lang::get_lang(Configs::get_value('lang'));
$lang['language'] = Configs::get_value('lang');
$infos = $this->configFunctions->get_pages_infos();
$title = Configs::get_value('site_title', Config::get('defines.defaults.SITE_TITLE'));
$menus = Page::menu()->get();
$contents = $page->content;
$page_config = array();
$page_config['show_hosted_by'] = false;
$page_config['display_socials'] = false;
return view('page', ['locale' => $lang, 'title' => $title, 'infos' => $infos, 'menus' => $menus, 'contents' => $contents, 'page_config' => $page_config]);
} https://github.com/LycheeOrg/Lychee-Laravel/blob/master/app/Page.php |
Picking up an old thread... here's another vote for the idea of an alias that could be used to give a friendly URL to an album. I'm really liking the look of Lychee and would like to migrate to it from other systems where I have shared URLs like '/Architecture' and '/Haddenham-Steam-Rally' with many others, so I want to keep legacy links working as much as I can, without writing lots and lots of nginx redirects :-) |
My feature request is similar to or would compliment #308
Previous photo galleries I have used create slugified friendly urls.
For example:
Some Album => www.example.com/some-album
Some Album / Sub Album 1 => www.example.com/some-album/sub-album-1
Some Album / I like Cats & Cocktails => www.example.com/some-album/i-like-cats-and-cocktails
This would make sharing and viewing links much more user friendly. I do see now that the album Id is passes in which is very efficient, but with some slight work this would work too. When and album is created or renamed the parent albums could be looked up and the names slugified, path generated, and stored in the DB. Then the lookup could be on that url-slug field instead of the id.
Laravel has a slug helper, but it may not be advanced enough to handle multiple spaces, and special characters. https://laravel.com/docs/5.8/helpers#method-str-slug
There are others on Packagist. I have seen ones that will do stuff like turn & in and and " - " into "-" instead of "---" (like in "Landmark - 25"=> "landmark-25")
https://packagist.org/?query=slug
Thanks for hearing my suggestion.
The text was updated successfully, but these errors were encountered: