emb-isaac
Returning Observer

Using Meta Fields for CSS & JS versioning

Is there a way in the CMS to view custom Meta Fields for an asset as you can with the "Content" panel?

 

I am developing a versioning system for my CSS and JS files, for cache busting. I store the version number as a Meta Field for the asset

asset.SaveMetaField("version", "1.2.0");

 I then check for a version number when rendering the link tag in my wrapper

Asset file = Asset.Load(peData.Raw["css_link_internal"]);
string fileVer = file.Meta["version"];
string fileParam = "";
if (!String.IsNullOrEmpty(fileVer))
    fileParam = "?v=" + fileVer;
Out.WriteLine(ServicesOutput.RenderCSSLink(file, qString: fileParam));

 
Is this an appropriate situation to use Meta Fields over Content Fields?

0 Kudos
1 Reply
EdwardChan
Crownpeak Employee

Unfortunately there is no way to view the saved Meta fields through the CMS UI currently (eg. there isn't a view in the CMS like the "Content" panel). Your use case seems to be a valid use case for the Meta fields. However, because it is not easily accessible like regular content fields, it might make more sense to just use Content fields at this time. With Content fields, at least you would be have a field that could be visible when editing an asset rather than having to programmatically pull those values. I'll go ahead and submit a feature request to our product team to see if we could add a view for the Meta data.

--


Edward Chan
Sr Product Consultant

## If I’ve helped, accept this response as a solution so that other’s can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..

0 Kudos