Can a CMS Collection read sub-folders?

Hi,

Looking to have one Collection Component but for neatness I’d like it to read from subfolders - is it possible?

For example:

Blog Content/
├── archive/
│ … └── old imported posts
└── current/
…└── new posts

The markdown files need to be in a single folder for the collection to work. Perhaps, prefix the original posts with “imported-” so that way it’s easy to tell them apart. You could then store them all in the same folder.

Hope that helps!

Thanks Dan,

I will implement something along those lines. I’ve done some testing with the archive in the meantime and have run into one other issue.

I have a fairly large blog archive of around 1,200 Markdown files that I’m migrating into an Elements CMS Collection.

When publishing all of these files as part of the Elements project, I found that not all of them were making it to the server, so as a workaround I uploaded the archive directly via FTP into the same folder used by the CMS Collection.

This works perfectly for the Collection itself. All of the FTP-uploaded posts appear correctly, pagination includes them in its page count, the individual CMS Item pages work, and their content/images display correctly.

However, the CMS Collection Search does not find any of the posts that were uploaded via FTP. It only appears to find items that have been added through the Elements project.

Does CMS Search rely on an index or other data generated at publish time from the items contained within the Elements project?

If so, is there a way to rebuild that index from the Markdown files already present on the server, or otherwise make FTP-uploaded CMS items available to Search?

Thanks!

I use a very similar approach—if not exactly the same one—to edit my Markdown files and, therefore, my blog posts.

The trick is that you need to create a kind of “dummy” folder in Elements. Ideally, it should have the same name as the folder that contains your actual files.

It’s important that both the Title and Folder fields are set for this folder. After that, link your Collection or Collection Search to this folder.


Publish everything once, and after that it should work without any problems.

Thank you Pegasus,

That helped to confirm my method wasn’t so wide of the mark.

Just to add a useful follow-up to my earlier post:

CMS Search does appear to index Markdown files that have been uploaded directly via FTP into the Collection folder.

In my case I added roughly 1,200 Markdown files. The Collection itself saw them immediately — pagination and individual Item pages worked straight away — but Search did not find the FTP-uploaded posts at first.

After leaving it for a while, Search began finding them correctly without me changing anything.

I didn’t time it precisely, but I’d estimate the indexing took around 40–45 minutes for approximately 1,200 files.

So it appears there is some form of server-side indexing taking place; it can just take considerably longer than expected with a large collection.