niceandserious / crafty-vagrant

A boilerplate dev environment for jump-starting Craft CMS projects
MIT License
57 stars 13 forks source link

Asset configuration #31

Closed ow closed 7 years ago

ow commented 7 years ago

Thanks for all your amazing work on this project! I had a quick question regarding assets – if I want to upload assets via the admin, how should I configure the assets section?

Right now, I have the relative directory set to /assets/images/ and the URL set to /images/ but it doesn't seem to work – I can't figure out how to load them either. I'm sure I'm doing something silly, but I can't figure out what...

nickautomatic commented 7 years ago

@ow Thanks! Glad you're finding it useful!

Regarding assets: if your file system path is assets/images/ then your URL will need to be /assets/images/ (ie. you still need the "assets" directory in the URL). Crafty's config file provides an environment variable of {siteUrl}, so you can also use a URL of {siteUrl}/assets/images/ if you want non-relative paths. I can confirm that with file path assets/images/ and {siteUrl}/assets/images/ the assets should be working. (I'm not sure whether the preceding slash you have in your file path could cause an issue, but it's not necessary).

For what it's worth, this is really a general Craft configuration issue, rather than anything Crafty Vagrant specific (though to be honest I have to look the above up every time I set up a new site, so perhaps it should go in Crafty's docs anyway!) In case you don't know about it, the Craft CMS Stack Exchange is a great source of help for this sort of thing. Good luck!