Blog

Replacing Files Without Replacing Links

You’ve probably needed to update an image on your site at some point. It’s possible that image has been referenced multiple times on your site, and by updating it in one spot you realize you might not remember all the places this photo is located.

Let’s say we’ve got to update an image of our staff member named Lennon. He’s based out of our Nashville office, and he’s essential to our day to day operations.

This is our current image of Lennon:

Lennon Commute - Sitewrench Replace pictures without replacing Links

We have faithfully uploaded this image into SiteWrench’s file system. We even named it “Lennon commute” before uploading it into SiteWrench so it’d be easier to find than a series of random numbers.

CMS for business - custom CMS Management | Sitewrench by Speak Creative

SiteWrench named it “lennon_commute.jpg” and automatically gave it the link “lennon_commute.jpg”. Now anywhere you insert this image in SiteWrench, it will use the file link /lennon_commute.jpg.

We know we can do several things to modify this file:
  • Update the General name that displays there in our Files view 
  • Update the link that’s associated with this file. The link automatically matches the General name, but if you adjust the General name without Renaming the file, the link is still “lennon_commute.jpg”
  • Replace the entire image
  • Rotate the image within SiteWrench
Sitewrench CMS - Made by Speak

In today’s tutorial, we are going to discuss the importance of the “Replace” and “Rename” functions for a file.

Renaming Files

(Not to be confused with “General renaming”)

If you rename a file, you are changing the path to that file. In normal human terms, this means that SiteWrench knows exactly where to find your file at all times by its name, which is like a street address. 

If you tell SiteWrench to link to the file /lennon_commute.jpg, it will do so faithfully. But if you rename the file to be /lennon_car.jpg and don’t give SiteWrench the updated name, it will get lost because the “address” is no longer valid. And as useful as 301 redirects are, you cannot set up 301 redirects for files. 

Why would I want to rename my file?

Renaming files is very useful if you have multiple instances of the same broken link on your site. Let’s say we have Lennon’s commute image on our site 13 times on various pages and page parts. 

Then the unthinkable happens: someone deletes the image because they want to upload a new one. Now all 13 references to this file are broken, and our site looks horrible.

Sitewrench CMS - Made by Speak Creative

We have two options:

  • Hunt down every reference to this link and re-link it to the new photo 13 times
  • Upload the new image of Lennon and rename the file so that it matches the link reference from the old, deleted file

The second option is more efficient and saves you time; you’re only updating one thing rather than 13 individual link references.

So how do I know what the old link was to my deleted file?

  • First check to make sure your deleted file is not in the limbo delete state. 
    • Check the box that says “show deleted”
    • Search for the file name
    • If the file appears with a “restore” and “delete” button next to it, either restore it or permanently delete it out of the system
Sitewrench CMS for agencies | Speak Creative

  • Assuming the file is permanently deleted, go to one of your link references
  • Flip to the HTML view
  • Find the file reference, in this instance it’s an image so it’s being read as <img alt="" src="/assets/1819/lennon_commute.jpg" />
Recognize the bolded bit? That’s the link name.

If you’re sure your old image is permanently deleted, not in the limbo delete state where you can still recover it, then you can rename your new file to be lennon_commute.jpg and it will replace all 13 instances with your new photo.

Here’s our new Lennon image:

Sitewrench CMS

Sitewrench for agencies and business - Sitewrench by Speak Creative


Let’s rename this file to “lennon_commute” (the system automatically adds in .jpg). Then choose “save and done.”

replacing file links for Sitewrench CMS - Sitewrench

Refresh your browser window and Voilà! Now your file is automatically pulling in the new image, and you didn’t even have to change a thing about those 13 references. All 13 of them are now pulling in this image, because the image has been renamed to match this link.

Content Management Systems - Sitewrench by Speak Creative

Replacing Files

Let’s use this same scenario. You’ve got 13 references to Lennon on your site and you need to update them all. But this time no one has deleted your image of Lennon. In order for the renaming operation to work, the old file must be deleted. But to avoid needing to delete that file, you can just replace the file instead.

The replace function is a great shortcut; it allows you to update the file’s content without adjusting anything about the link. This means that all 13 of your references to Lennon are safe. You don’t need to go in and rename the file, and you don’t need to find all 13 references to adjust those.

Pretend everything I talked about above concerning Renaming did not just happen. Here’s our original image on our page again.
Sitewrench CMS - CMS for agencies
  • Go into the file details for this image and click on “Replace”

Sitewrench CMS for Business and Designers | Sitewrench

  • Select “Click to Upload” and find your file on your computer
  • Select “Save and Done”

No matter what your file was named on your computer, the SiteWrench link under “Rename” will NOT be adjusted when you use the Replace function. Your link is safe and every reference will now pull in this new image like you told it to.

Sitewrench CMS for Business and Designers | Sitewrench

We hope you found this tutorial helpful. Renaming and Replacing files is an essential shortcut on SiteWrench that will help you make faster, more efficient changes. If you have any questions about SiteWrench that you’d like us to address, don’t be shy! Leave us a comment or fill out a support ticket and we’ll be glad to answer your questions or provide a tutorial to address your question. You can always sign up for free weekly SiteWrench training at 2pm on Tuesdays.
Posted by Nicole Davis at 9:46 AM