Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ruurd 3 posts 84 karma points
    Apr 22, 2022 @ 13:08
    Ruurd
    1

    Changing file and filename but maintaining the same url within Umbraco

    Hello,

    My client uses Umbraco Media to upload documents. These documents are displayed on the website via the media picker. Now my client needs to update these documents every few weeks. Within Umbraco that is no problem because they can just go to the media item, click on remove file and upload a different version. Because of the use of umbraco media picker the site is always finding the right url.

    The problem is that the client also distributes the url's to these documents in newsletters etc, things outside the site. So when the client uploads a document and changes it later (with a different file name) the old url will no longer work.

    Now to solve this problem i suggested the client uploads the new file with the exact same filename. That will result in the exact same url. This will work but it is a bit difficult for them and they are affraid it will be very error sensitive.

    Now my question is; is there a way to approach a file via a url that doens't contain the filename. That it will look at the id of the media item for example, and find the right url that way?

    Or is there a completely different way to change documents and keep a consistent url?

    Hope someone has an idea on how to approach this problem.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Apr 22, 2022 @ 14:21
    Nik
    0

    I built something for a client in a v7 site to handle this.

    It's a fair amount of work to do, but it's quite a nice solution IMO.

    The idea being that within Umbraco Media section you have a top level node that is a special type, "Versioned Document Store". In there you have another type called "Versioned Document" which is essentially a folder. They upload all of the versions of a specific document to said folder.

    e.g.

     Versioned Document Store
           -> Versioned Document - Media item
                    -> Media item Version 1
                    -> Media item Version 2
                    -> Media item Version 3
    

    Then in the content tree you set up a "MediaLibrary" root node, and under each you create a "VersionedMedaItem" instance which has a picker that allows you to pick the "Versioned Document" from the media library.

    Assign a base URL to your Medial Library, e.g. media.domain.com,

    Then every instance of "VersionedMediaItem" has it's own url that doesn't change, but you have a root hijacked controller for it that servers up the most recent "version" from wthin it's versioned document collection.

    Within your main site, you then pick the node from the MediaLibrary instead of the Umbraco Media Section, when you want to link to a media item.

    Hope that makes sense

    Nik

  • Dennis 75 posts 398 karma points MVP 2x
    Apr 22, 2022 @ 14:48
    Dennis
    0

    Hi there,

    Would a redirect from the old url to the new one suffice? If so, you could try out the url tracker package (I am one of the developers of this package ;) ). At the moment it's still in prerelease for Umbraco 9, but it should be ready for production next week if we don't find any critical bugs.

    Feature requests and bug reports are ofcourse very welcome and I'll happily answer any questions about our package that you may have.

  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    Apr 23, 2022 @ 04:16
    Paul Seal
    0

    Hi

    I have a different take on this. If I were sending out these emails I would use a service like bit.ly and have a fixed url that is the same all the time but just login to bit.ly and change where the url points to.

    If you don’t want to use a 3rd party service to do this you could install Skybrud Redirects and achieve the same thing using that. Add a redirect for /my-media-item/ and redirect it to the correct media item url each time it changes.

    Cheers

    Paul

  • Ruurd 3 posts 84 karma points
    May 02, 2022 @ 07:40
    Ruurd
    0

    Thanks everybody for the responds :)

    The answer about redirecting the old url to the new got me thinking and i used the SEOChecker package to get the old urls to redirect to the new ones :)

    Now the client is able to change the document in the media item and also use a different file name.

Please Sign in or register to post replies

Write your reply to:

Draft