Using a URL, I think? I want to access it directly by folder, not URL.
In this case, you can simply enter the full URL to the resource.
So, I can’t specify a folder directly?
We won’t be support listing a folder of resources, however, you could manually add the resources as an array of URLs in the front matter of your markdown file.
Something like this
title: My Markdown file
resources:
- image:
- title: Picture 1
- src: https://my-site.com/resources/picture.webp
- image2:
- title: Picture 2
- src: https://my-site.com/resources/picture-2.webp
I probably need to wait until I can try out the beta.![]()
At the moment, I just specify in the image in the markdown as:
image: picture.jpg
and the blog PHP code knows to go and pick it up from (for example):
data/images
I am using the following at the moment, which works well with my blog PHP code, to pick the image from my markdown:
My code substitutes {IMAGE} with the image in the markdown file, prefixed by the image folder.
This is an advanced use-case, however, the CMS does support passing in a config. That config can specify where the resources are stored — this is how the CMS automatically prepends the correct relative path to the resources (I mention this in the latest CMS video).
So in theory, if you were to create your own component(s), you could setup the config to point towards a remote folder, something like this:
<?php
// include the required cms files
$options = [
'resources' => [
'path': 'http://my-domain.com/path/to/folder'
]
]
$cms = cms($options);
$items = $cms->collection('path/to/folder')->get()
This would automatically prepend http://my-domain.com/path/to/folder to all resources.
The above code isn’t going to work with the first beta release of the CMS, but this use-case is supported. I’ll need to do a couple of things, including documenting this, before you’ll be able to use it.
