sixem / ivfi-node

IVFi is a directory indexer written in Node that aims to make it easy to browse and explore web-accessible directories.
https://git.five.sh/ivfi/
Other
33 stars 3 forks source link

Meta tag support #17

Closed evwltrs closed 1 year ago

evwltrs commented 1 year ago

I would like to suggest for ivfi-node to automatically generate meta tags for each directory, with the description tag being set to the contents of the readme. This is useful when sending links as it provides a helpful embed on many websites.

Something like this: <meta name="description" content="extract from readme" />

Thanks for the awesome software :)

evwltrs commented 1 year ago

I have a working proof of concept but it really doesn't work very well as stripping the html and markdown is cumbersome and doesn't generate a very nice preview. I was thinking we could add support for a dot file that allows html to be injected into the page for that specific folder... what do you think about that idea?

evwltrs commented 1 year ago

18 for a very basic draft - needs a lot of work

sixem commented 1 year ago

I have a working proof of concept but it really doesn't work very well as stripping the html and markdown is cumbersome and doesn't generate a very nice preview. I was thinking we could add support for a dot file that allows html to be injected into the page for that specific folder... what do you think about that idea?

Something like that could work. I agree with you regarding the README contents, as it can be a bit cumbersome to strip all the HTML tags and MD syntax away from the actual file, and sometimes you may also want to add things to the README that you don't necessarily want to have included in the description as well.

Adding some support for meta tags is something I've been wanting to do in the past, but that I've never really gotten to yet. In the PHP version, we have support for just injecting contents to the header/footer etc., so that works there, and something similar may work here too.

However, I was also thinking about just a simple meta option for the script, where any type of meta tag can be added, and it would be automatically injected into the header. Expanding on your idea with the dotfiles, maybe we could add a simple feature where you can set default meta tags in the options if you want to, but on top of that, you can also have a .meta file or something similar in each directory that would override any of the default values?

evwltrs commented 1 year ago

I think adding an option in the script to set meta tags is a great idea and should be added.

Expanding on the dotfiles idea I think it would be interesting to take it either further than just .meta and instead maybe go for a more scalable .ivfi file. This could allow you to customise different settings per directory, including setting meta tags etc. It could even allow stuff like setting a unique theme for a directory or turning on and off options. A few things to think about:

However, if you think this will be too large of an undertaking or you think it would create bloat the .meta file is still a good idea.

Let me know what you think :D Thanks

sixem commented 1 year ago

I think adding an option in the script to set meta tags is a great idea and should be added.

Expanding on the dotfiles idea I think it would be interesting to take it either further than just .meta and instead maybe go for a more scalable .ivfi file. This could allow you to customise different settings per directory, including setting meta tags etc. It could even allow stuff like setting a unique theme for a directory or turning on and off options. A few things to think about:

* What would the syntax look like?

* Could we just use a json file with an options object like the one passed in during launch? (this could be easier)

* Will the syntax be the same for the node version and the php version (I think this is important for versatility)

However, if you think this will be too large of an undertaking or you think it would create bloat the .meta file is still a good idea.

Let me know what you think :D Thanks

That's a really good idea, I like it. Having a "universal" dotfile for the script is great, as it also avoids any unintentional conflicts with other potential dotfiles. Plus, it makes the name less ambiguous which is good, and it also gives us the option to expand on the feature later.

Unless you feel inclined to create a new PR, I can experiment a bit with it and throw one up later.

As for the format, seeing as we're dealing with Node, JSON may very well be the easiest to use? Or do you have any better ideas?

EDIT: Should we add this, I'll find a way of replecating it in PHP, should we choose the JSON format. That shouldn't be a problem. I'm unsure of how to add the options, seeing as the Node and the PHP version are a bit different there. Maybe just having cross-version options for the dotfile is the best, and then we'll just merge that with whatever options we already have in PHP and Node respectively.

evwltrs commented 1 year ago

As for the format, seeing as we're dealing with Node, JSON may very well be the easiest to use? Or do you have any better ideas?

JSON sounds good to me 👍

Unless you feel inclined to create a new PR, I can experiment a bit with it and throw one up later.

I'll leave this one for you, but happy to chime in with ideas. Good luck :D