Expand my Community achievements bar.

SOLVED

Static files for internal and external consumption

Avatar

Level 7

My organization has a few JSON files that we like to re-use across out website. 
countries.json
countries_city.json
countries_zip.json
They will be used for the forms drop down, and some sort of backend logic.
Where is the best place to store these files.

We were thinking of /etc/designs/my-brand/static/*; what are your thoughts?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @SupportMember 

 

/content/my-brand/static/* content will be added via code and will not be visible to author in a readable format as it's not a cq:Page content type.

 

As it will be deployed via code, it will be available on both author and publish instance and we do not have to publish it manually. Publishing it also will not make any difference.

 

Direct access to /content/my-brand/static/* can be blocked in dispatcher by applying the rule.

 

Ideally we should not keep anything under /etc and all customized content should be stored under /content.

 

Thanks!

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @SupportMember 

 

As these are the content related stuffs, I will keep these under /content/my-brand/static/* folder and use it from there as needed.

 

This is how currently I use as well in my project when there is a requirement for static content reference.

 

Hope this helps!

 

Thanks!

Avatar

Level 7

Thank you for the response, but

/content/my-brand/static/*  

 

should also be accessible to our public users too. Would you do some apache rewriting to [PT] the request to the files? what happens when an author accidentally publishes this file? Also we don't want the authors to see these.

Wouldn't /etc/designs/my-brand/static/* be the best place to keep the files?

 

Avatar

Correct answer by
Community Advisor

Hi @SupportMember 

 

/content/my-brand/static/* content will be added via code and will not be visible to author in a readable format as it's not a cq:Page content type.

 

As it will be deployed via code, it will be available on both author and publish instance and we do not have to publish it manually. Publishing it also will not make any difference.

 

Direct access to /content/my-brand/static/* can be blocked in dispatcher by applying the rule.

 

Ideally we should not keep anything under /etc and all customized content should be stored under /content.

 

Thanks!