Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webmention based comments #62

Closed
petermolnar opened this issue Sep 29, 2014 · 5 comments
Closed

webmention based comments #62

petermolnar opened this issue Sep 29, 2014 · 5 comments
Labels

Comments

@petermolnar
Copy link

hi all,

I was wondering how a webmention based "commenting" system could be implemented in Grav.
So far I was thinking of a directory names comments which would contain 1 comment per 1 file with the same YAML + Markdown setup as the articles.

Any thoughts on this?

@w00fz
Copy link
Member

w00fz commented Sep 29, 2014

Have you considered http://webmention.io? Looks like they don't have open signups, yet, but it's open source and you could run it on your server. All you would need then, is a simple grav plugin that runs the JavaScript and through JSONP collect all the pingbacks.
This could technically even just run through theme, without needing a plugin at all.

Is this what you are trying to do?

@w00fz w00fz added the question label Sep 29, 2014
@petermolnar
Copy link
Author

The main reason why I'd want to go with Grav is to have a flat file based system what I can easily backup/archive. Having the comments out of this system does not sound good for me.

You're right with the part that this is an easy and quite effortless solution, but I'd really love to actually store the comments somehow.

What I was thingking is something like this:

---
name: [commenter name]
url: [commenter url]
email: [commenter email]
avatar: [commenter avatar]
source: [pingback/webmention source url]
date: [datetime]
lastcheck: [datetime of last check if it's a webmention and if it's still valid]
type: [comment/like/pingback/etc.]
---
===
[comment body]

@rhukster
Copy link
Member

It seems to be this could be done with a custom plugin. As you say the underlying architecture of Grav lends itself pretty easy to what you are describing. I definitely feel like this should not be 'part' of the core grav in order to keep that lean, focused, and efficient. But a 3rd party plugin providing this functionality totally makes sense. Is this something you would be interested in developing???

@w00fz
Copy link
Member

w00fz commented Sep 30, 2014

Maybe as a JSON file, per page, would be more efficient than a single YAML file per comment?
The benefit of JSON over YAML, at least in this case, is that it's much more portable and faster to decode/encode. It also allows to change structure in the future if you ever need, opening the possibility of easily filter by type if you would like... and so on.

But more importantly, consider having 10 pages with 50 comments (likes / pingbacks / webmentions / comments, etc). With the single file approach it would be 5000 files that you'll have to read and parse constantly. Sure you will have to definitely use cache there, but still it will never be as efficient as having all the data you need in a page, in its own single file.

The structure of the JSON could really be stored in different ways, for instance a raw format could be:

[
    {
        "name": "[commenter name]",
        "url": "[commenter url]",
        "email": "[commenter email]",
        "avatar": "[commenter avatar]",
        "source": "[pingback/webmention source url]",
        "date": "[datetime]",
        "lastcheck": "[datetime of last check if it's a webmention and if it's still valid]",
        "type": "[comment/like/pingback/etc.]"
    },
    {
        "name": "[commenter name]",
        "url": "[commenter url]",
        "email": "[commenter email]",
        "avatar": "[commenter avatar]",
        "source": "[pingback/webmention source url]",
        "date": "[datetime]",
        "lastcheck": "[datetime of last check if it's a webmention and if it's still valid]",
        "type": "[comment/like/pingback/etc.]"
    }
]

But if you wanted a more structured and organized approach you could go:

{
    "comments": [
        {
            "name": "[commenter name]",
            "url": "[commenter url]",
            "email": "[commenter email]",
            "avatar": "[commenter avatar]",
            "source": "[pingback/webmention source url]",
            "date": "[datetime]",
            "lastcheck": "[datetime of last check if it's a webmention and if it's still valid]",
            "type": "[comment/like/pingback/etc.]"
        },
        {
            "name": "[commenter name]",
            "url": "[commenter url]",
            "email": "[commenter email]",
            "avatar": "[commenter avatar]",
            "source": "[pingback/webmention source url]",
            "date": "[datetime]",
            "lastcheck": "[datetime of last check if it's a webmention and if it's still valid]",
            "type": "[comment/like/pingback/etc.]"
        }
    ],
    "likes": [
        {
            "name": "[commenter name]",
            "url": "[commenter url]",
            "email": "[commenter email]",
            "avatar": "[commenter avatar]",
            "source": "[pingback/webmention source url]",
            "date": "[datetime]",
            "lastcheck": "[datetime of last check if it's a webmention and if it's still valid]",
            "type": "[comment/like/pingback/etc.]"
        }
    ],
    "pingbacks": [
        {
            "name": "[commenter name]",
            "url": "[commenter url]",
            "email": "[commenter email]",
            "avatar": "[commenter avatar]",
            "source": "[pingback/webmention source url]",
            "date": "[datetime]",
            "lastcheck": "[datetime of last check if it's a webmention and if it's still valid]",
            "type": "[comment/like/pingback/etc.]"
        }
    ]
}

Just some thoughts 😃

@nunocodex
Copy link
Contributor

I working to this idea before i trash the project because the online comments system is working fine and i can stay secure i do not lose any comments from various sites. I suggest you to change your idea to have a grav plugin for manage your site comments :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants