Solved

Updating files

George_Ellison
New Member
4 0 0

Hi all, wonder if anyone can shed light on the best practice for updating files. We have some PDFs that we've just begun uploading to our store, and these are product manuals or product info. So occasionally they need to be updated, and I assumed I'd be able to somehow map the link from the old one to the link to the new one so that any links out there would take viewers to the latest version of the doc. Should I just do a 301 redirect for this do you think, or is there some better way?

 

When I look at the Shopify documentation it just says "edit the doc, then upload it", so I thought maybe if it had the same file name their system would recognize it and update things automatically. But it seems not, when I upload an updated doc the URL changes, but the link still takes me to the old doc, even after refreshing the page with the links:

 

https://cdn.shopify.com/s/files/1/0653/7868/1077/files/ToneShapers-CORE-Wiring-Diagram-HH1-VT5-Dunca...

 

https://cdn.shopify.com/s/files/1/0653/7868/1077/files/ToneShapers-CORE-Wiring-Diagram-HH1-VT5-Dunca...

 

I would think this is going to be an ongoing issue, just trying to get off on the right foot with the best practice here. Any help appreciated!

 

George

Accepted Solution (1)

PaulNewton
Shopify Partner
6274 572 1310

This is an accepted solution.

You can't replace a file and keep the same url, as the files are distributed on a CDN.

And since it's on a CDN I don't think redirects are a solution.

 

I thought maybe if it had the same file name their system would recognize it and update things automatically

Typically not having file links update is a result of the url being hardcoded in theme, or content,  as a static piece of text; Instead of being a a liquid statement to dynamically render a url in the theme using hosted file filters which do work based on the name of a file in the files admin.

I.e. cdn.shopify.com/s/files/1/0653/7868/1077/files/ToneShapers.pdf vs {{ ToneShapers.pdf | file_url }}

https://shopify.dev/api/liquid/filters#hosted_file-filters 

https://shopify.dev/api/liquid/filters#file_url 

 

When I look at the Shopify documentation it just says "edit the doc, then upload it"


Could you link to the documentation being referenced?

 

If you need this fixed to have dynamic links in the themes you can contact me, info in signature please provide context such as post url, store url, issue detail,etc.

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


View solution in original post

Replies 4 (4)

PaulNewton
Shopify Partner
6274 572 1310

This is an accepted solution.

You can't replace a file and keep the same url, as the files are distributed on a CDN.

And since it's on a CDN I don't think redirects are a solution.

 

I thought maybe if it had the same file name their system would recognize it and update things automatically

Typically not having file links update is a result of the url being hardcoded in theme, or content,  as a static piece of text; Instead of being a a liquid statement to dynamically render a url in the theme using hosted file filters which do work based on the name of a file in the files admin.

I.e. cdn.shopify.com/s/files/1/0653/7868/1077/files/ToneShapers.pdf vs {{ ToneShapers.pdf | file_url }}

https://shopify.dev/api/liquid/filters#hosted_file-filters 

https://shopify.dev/api/liquid/filters#file_url 

 

When I look at the Shopify documentation it just says "edit the doc, then upload it"


Could you link to the documentation being referenced?

 

If you need this fixed to have dynamic links in the themes you can contact me, info in signature please provide context such as post url, store url, issue detail,etc.

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


George_Ellison
New Member
4 0 0

Hi Paul, thanks for the response! The reference is from this page: https://help.shopify.com/en/manual/shopify-admin/productivity-tools/file-uploads#edit-a-file

 

The instruction is this: If you need to make changes to an image or a document, use document editing software, and then upload the file again., which is not very helpful.

 

If there is a way to make these links dynamic based on the file name, that sounds interesting. I just bought you coffee, would like to discuss further.

Richard_Monette
Shopify Staff
14 2 5

Hey George, there is a new feature which allows you to Replace a file in-place. You can access it under the Content > Files area under the navigation.

 

Screenshot 2023-03-31 at 9.25.12 AM.png

 

If you click through a PDF you should see a preview modal, under the more options ... menu there will be an option now to Replace that file.

 

Screenshot 2023-03-31 at 9.27.26 AM.png

 

Using this option will overwrite the contents of the file so any links you have to it should continue to work.

To learn more visit the Shopify Help Center or the Community Blog.

BountyB
Visitor
1 0 0

Hi Richard, I too found the method you show and tried it.  I had PDF instructions that I updated and used the "replace" shown above and the old file kept showing up even after multiple refreshes. I then used the "copy" url link and compared it to the old link and the last "v" number in the CDN file had changed so it was not an edit of the original number.

 

I also noted here, https://help.shopify.com/en/manual/shopify-admin/productivity-tools/file-uploads, "Replace an existing file with a new file, and keep the same file name and URL handle. You can replace a file only with the same file format, such as replace a JPG file with another JPG file." does indeed keep the original URL but the CDN link location changes when I compare so I am still struggling to find a solution for global PDF changes.

 

Makes me think if the PDF URL name does not change, how to access/complete the URL Shopify shows and link directly and thus skip the CDN link?

KC