Can grav integrate existing file system resources?


#1

I’ve never used grav. I’m a very database oriented person so it might seem counter intuitive to have an interest in grav but there is a circumstance that I’d like to check into.

I have to deal with an existing file system based knowledge store. Structurally it’s very simple, folders and files organized by topic and date. The root folder is “ref” for reference. A typical section is like this:

ref
–apex (a folder)
----20180901 installation on bolide09 (a folder)
------sometextfile.txt (contains textual info)
------image01.png
------image02.png
–drupal (a folder)
----20180905 update to 8.6.1 (a folder)
------anothertextfile.txt (contains textual info)
------log.log (a text file)
------image01.pgn

and so forth. What’s good about the system as it has has the simplicity and versatility of the file system, and also that is that everything is discoverable in a clunky manner - if we know the topic (apex or drupal) and can approx the time frame, the info will be found. Where is lacks is search, integration, cross referencing, etc.

Is there any chance that grav can (in part) lean on an existing structure like this? Not import the information (which is what I’ve done in my turn-it-into-a-database experiments), but actually tap the existing assets? It can be very low overhead to place whatever resources are useful into the event’s folder. That’s why I have been hesitating to pull it into a db.

My initial guess is that this kind of data adoption will be difficult even for a file based system like grav, but thought it be worth asking. There might be other reasons to evaluation grav but this is my initial interest.

I’m not a php coder so it’d be a compound task to attempt to write something that might extend grav for a purpose like this.


#2

The file structure is similar to how Grav structures its data, but the file naming convention is more rigid. Specifically, the name of the file being rendered needs to match a template in the theme you’re using. (See my Knowledge Base skeleton, specifically the pages folder.) So you’d have to do some file renaming at the very least.

Grav is also based on Markdown with YAML frontmatter. You’d need to make some minor adjustments to the text files to pull in the media, for example, and then add some frontmatter to at the very least clean up the slugs (the names of your folders, which will become part of the final URL).

If you didn’t want to alter the content, you could pull in a gallery of the media files in your page template, but you’d probably still need to add frontmatter to the files to ensure a sane URL structure.


#3

Interesting…thanks. Does it mean that if I adjusted the file and folder names to work with grav, I could somehow “point” Grav at the root dir and Grav would “adopt” the stack?

If the file names have to conform to the few names of the templates that the theme provides, yes that would be a lot of cleanup, but the bigger issue might be that a folder can host multiple files of the same type (textfile1.txt, textfile2.txt). They can’t both have the same name obviously. I’m not sure how I could deal with that. Any cleanup would have to be scripted there are two many folders and files.

I should install Grav and get a bit of hands on.


#4

I don’t know how you could avoid manual tweaking. Scripting will take you far, but… The multiple file issue for example is a problem. Those will have to be put in separate folders or combined.

Grav may not be the tool you’re looking for. You could generate a full text index and then just host a search tool that will point them to the files, that they then have to manually go and look up. Or make the files available in a raw format. But if you want to prettify the whole thing, you’re going to have to get your hands dirty at some point.