The Media Library isn't publishing or updating my item(s)
Or, I want to replace a PDF with a new version but keep the name
Have you added or updated something in the media library, and published it, but you're not seeing it on the live Website?
Is everything checked in?
First, make sure the folder that the item is in has been checked in an approved. When you make a new folder, Sitecore checks it out to you, and it's easy to forget to check these in and publish them--but if you don't, then nothing inside the folder will publish.
If the button says "Edit", you're good. If it says "Check in" or "Approve," click the button to get the item ready to publish, then publish it.
If that wasn't the problem, there could be something amiss with how Sitecore is working with the media file. The following procedure usually rectifies things.
Replace an old file with a new version
Often we want to keep the file name and URL of a document, but update it. In Sitecore parlance, you have to detatch the original version in the Media Library, then attach the revised version.
The file type needs to stay the same. This works if you're replacing a PDF with a newer PDF, for example, but not if you're replacing a PDF with an Excel document.
-
In Media Library, click on the icon in the menu tree on the left for the file you added.
-
On the Sitecore screen on the right, just under the filename at the top, there's a box that says "Media". Right under the word "Media" are three button choices: Detatch, Attach, and Download.
-
First, we want to make sure Sitecore forgets about whatever has confused it. Click "Detatch". You might get an error message saying there's nothing to detatch, which is Sitecore's way of saying it can't figure out what it was supposed to be doing. That's fine, just agree and continue.
-
Now click the "Attach" button.
-
Re-upload the misbehaving file.
-
Click "Save" in the usual place in the toolbar.
-
Click the parent item over in the left--the container that holds the thing you want to publish.
-
In the toolbar, click the "Publish" tab.
-
Click the tiny arrow to the right of the "Publish" label on the button, so you get the drop-down menu.
-
Pick "Publish item". It's fine if it asks you if you want to save something. Just agree, and continue.
-
In the wizard, make sure "Publish sub-items" is checked.
-
Proceed as usual.
Now stand up, stretch, and give it a bit of time to upload. Media library stuff takes anywhere from a few seconds to a few minutes.
Go back and see if the link is working.
Explanation, if you're interested:
Remember, Sitecore is really just a database, and when we add files we're actually doing two things. Sitecore sticks the file somewhere obscure, and then it generates a kind of shortcut to the file. It uses that shortcut to link to the actual physical media item.
Sometimes, the shortcut for whatever reason is wrong. It's just not connecting with the real item. That's what happened here.
If you replace something in the Media Library with a newer version of the same name, Sitecore doesn't really overwrite it like you'd think it would; it just adds another item in the database and makes another shortcut. So, both versions of the file are floating around out there. Since the shortcut was to the old version of the file, it keeps showing up even though you know you uploaded the new one.
In both cases, we have to force Sitecore to forget about the misbehaving link. In order to do that--to make sure it knows to get rid of the old link and put in the right one--you have to publish the parent folder (the one containing the item you've been working with). That's because that parent folder contains, unseen to us, the instructions to the database to delete the old link and to put in the right one. What we see as a "folder" is a bunch of instructions to the database. When we publish the folder, we are basically saying, "Okay, forget everything you ever thought you knew about everything here, clean it out, and use this instead."
If it's still not working, it's probably time to stop fighting it and just contact webteam@kingcounty.gov.