FR: unique URL for news/blogs

Is it already possible and I don't see it or is it missing?

I am looking for the option to get e.g. the date and maybe even time automatically in the URLs of the news/blogs.
In this way it is possible and makes sure that I will get unique URLs.

Thanks.

Comments

  • acrylian Administrator, Developer
    edited February 2019

    There is no option. You can either edit the titlelink of an article manually or you can create a plugin that hooks into via a filter on saving to modify the titlelink.https://www.zenphoto.org/news/zenphoto-plugin-architecture/#zenpage
    That would be the new_article filter or also the update_article one but you probably don't want to change it further for SEO.

  • vincent3569 Member, Translator

    Hi Malte
    I think it is a good feature to be sure to have unique URLs.
    In my blog, I have a post called "picture of the month", and I have to manually change title link:
    https://www.vincentbourganel.fr/news/photo-du-mois-decembre-2018/
    https://www.vincentbourganel.fr/news/photo-du-mois-decembre-2017/
    ...

    so if zenphoto could manage that kind of timestamp in news title link, I think it would be a nice improvement.

  • I was rather thinking of e.g.

    https://mysi.te/zpc/blog/2019/02/08/and_the_title_of_the_entry

    maybe even with some kind of a /timestamp/ after the date.

  • acrylian Administrator, Developer

    @vincent3569

    I think it is a good feature to be sure to have unique URLs.

    so if zenphoto could manage that kind of timestamp in news title link, I think it would be a nice improvement.

    As mentioned you can already have that by creating a filter plugin and modifying the titlelink by appending or prefixing on saving and/or updating.

    maybe even with some kind of a /timestamp/ after the date.

    Sorry, such an URL is not supported and there are no plans to do so. We have simpe URLs on purpose actually and in case you haven't noticed there is no URL hierachy on pages, too. That way URLs never break if a subpage is moved to another level. (And on mobile no one actually pays atention to URLs anyway ;-))

  • @acrylian

    I am only thinking of news/blogs entries.
    So no "pages" or "albums".

    My concern is, that if you create an blog entry about something (e.g. product) and over time you make more of these blog entries (for what ever reason) links/urls may get mixed up. Especially if products have the same name.

    A German manufacturer gave - after years of using a product name - a new product the old name.

    You write a blog about the "new" product which, then may get the same blog/news title = URL, how does ZPC know where to go?

    These are just some ZPC-beginner concerns - based on experiences with other CMSystems.

  • acrylian Administrator, Developer
    edited February 2019

    I do understand what you mean. As said you can solve it using a plugin to append a date string or a hash or whatever you like.

    Zenphoto creates the titlelink from the title so if that is unique it will be that. You always can adjust the titlelink manually before saving or even afterwards if you must (permatitlelink checkbox). Zenphoto warns if the titlelink result exists already and appends a hashnumber automatically (don't remember right now based on what but it results in an unique url).

    Introducing a hierachy as you suggested makes a lot things complicated because such a structure requires a lot of excepts to not collide with any album structure.

  • Just a thought: Maybe you can achieve this by using .htaccess and mod_rewrite. You could include a slug in your URI and use it to rewrite said URI to point at a script that performs the lookup of the original Zenphoto URI and delivers the content of that URI.
    (Of course this would not change how Zenphoto creates URIs.)

    Example:
    When requesting http://zenphoto.example.com/slug/2019/02/12/some-cool-title a rewrite rule matching /slug/* can re-direct this request to /rewrite_lookup.php which will perform a search for pages that where published on 2019-02-09 with the title "some cool title". If a single entry can be identified the script will request the corresponding page and print its content, i.e. delivering the response to the client.

  • acrylian Administrator, Developer

    Probably somehow possible but it would really overcomplicate things and most likely cause some issues because Zenphoto simply does not generate urls like this internally.

Sign In or Register to comment.