为Shopify CDN是怎样产生的资产网址是什么? [英] How is the asset URL generated for the Shopify CDN?
问题描述
假设我要上传Shopify上的一家商店叫做logo.png的形象。
Assume I have an image uploaded to a store on Shopify called 'logo.png'.
在液体模板,我可以生成像这样为它网址:
In a liquid template I can generate a URL for it like this:
{{ 'logo.png' | asset_url }}
这生成一个URL,例如:
This generates a URL such as:
的http:// static.shopify.com/s/files/1/0072/7952/t/2/assets/logo.png?100239
我要生成Shopify之外的这个网址的第三方应用程序使用。
I want to generate this URL outside of Shopify for use in a third party app.
从的https://github.com/Shopify/pixelprinter/blob/master/app/liquid/filters/shop_filter.rb#L84
我可以看到如何使用店铺ID生成除了/ T / 2
段的一切。
I can see how to use the shop id to generate everything except the '/t/2'
segment.
是什么决定了这最后的环节?
What determines this final segment?
推荐答案
您不应该依赖于一种特定的方式生成的URL。正如你所指出的那样,你可以使用过滤器ASSET_URL液体中,你可以使用资产API 获得的URL从应用程序的资产。
You should not depend on the url being generated in a specific way. As you have pointed out, you can use the asset_url filter in liquid and you can use the Asset API to get the url for an asset from an app.
如果你只是好奇,那么我相信你的情况最终段指定它是ID为2的一个主题。
If you are just curious, then I believe the final segment in your case specifies that it is a theme with id 2.
这篇关于为Shopify CDN是怎样产生的资产网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!