Guidelines on sub-domain for static files [newbie]

(had to modify example links due to 2-link limitations)

I’ve moved through a number of CMSes over the years (homebrew, wordpress, movabletype, pelican, mezzanine, wordpress again). I’m pretty much sold on grav as my next one. Already setup a test instance and imported my markdown posts.

One thing I learned to do was to split my site between www (dot) example (dot) com and static (dot) example (dot) com. I put all the media that shows up in my posts under static, and as much as possible, assets related to templates. This means that when I migrate my content, the links to static_/somedir/image.png remain the same, even if the CMS managing the media changes.

So I have a few questions:

  1. I see grav uploads media to the same folder as the page. Can this behavior be changed? I like the drag-and-drop capability, and the little button to insert the markdown pointing to the image. But can can that behavior be changed so uploads go to a different folder/set of folders, and the insert action puts in a full URL?
  2. Grav has a /images folder where resized thumbnails seem to end up. Can we have the generated URL be changed (static.example.com/images or static_grav/images)?
  3. At some point I’ll be extending or making my own theme… when I do that, I’ll probably want to serve my assets out of the static_ domain. Any good pointers on this so I’m not hardcoding any URLs?

Hi there. I store images differently too (though not to the extent that you do), so I’ll see if I can address some of your questions per number…

Disclaimer: I don’t use the Admin UI for anything (GitSync or SFTP instead) so just consider that my publishing method differs from yours.

  1. Yes you can upload images anywhere, just not via the Admin UI (or maybe you can tweak the Admin file uploader - someone will have to chime in on that). Personally, for majority of my images, I upload them to user/pages/images/ which is non-visible folder and then call the image in markdown such as ![](/images/some-album-art.jpeg)

  2. Unsure. Grav’s image processing confuses me somewhat. For some of my blog posts I use the native header_image stuff (placing the image in the same directory as the markdown fie), and the image get dumped into Grav’s hashed /images directory structure, which I don’t care for (why I rolled my own method as above).

  3. You could hardcode relative URLs? :man_shrugging: