11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
16.84k stars 487 forks source link

Webmentions? #57

Closed zachleat closed 6 years ago

zachleat commented 6 years ago

https://indieweb.org/Webmention

Looks like this may require a server side component, not sure of the options here yet.

https://twitter.com/nhoizey/status/961271272167694336

miklb commented 6 years ago

Yes, a server side component would be necessary. webmention.io is one such option. There's a Jeykll Gem plugin that handles sending and storing the webmentions from wm.io JSON response so something like that could be built for eleventy

zachleat commented 6 years ago

This repository is now using lodash style issue management for enhancements (see https://twitter.com/samselikoff/status/991395669016436736)

This means enhancement issues will now be closed instead of leaving them open. The enhancement backlog can be found here: https://github.com/11ty/eleventy/issues?utf8=%E2%9C%93&q=label%3Aneeds-votes+sort%3Areactions-%2B1-desc+

vipickering commented 6 years ago

Hope this helps!

You can do Webmentions on a static site (I am currently building my own for Jekyll) but this can get quite complicated.

Using the Jekyll Gem is a looooooong build process, so I wouldn't go down that route. The larger your content becomes the larger the build time, it's a bad pattern. Having one plugin to "rule them all" is a brittle bottleneck.

A better pattern is the following:

For Incoming mentions around the web

  1. Use webmention.io for your endpoint.
  2. The user would need to signup and get their Auth token. It's ok if this is publicly visible, as all a user can do is make a GET request to see all the webmentions for a given user.
  3. At build time Eleventy would need to go do a GET request and compare against it's local JSON data file. Append all new mentions, then build the Webmentions from Microformats snippets. (You will also need snippets for each webmention type).

For posting data in to the static site

Your right you need a separate service to do this. The best implementation I've seen is by @voxpelli

https://github.com/voxpelli/webpage-micropub-to-github

This service polls for mentions on other services such as Ownyourgram or OwnyourSwarm. Once it gets those it creates a markdown file and submits it to your Github repo. Accepting the merge, will then trigger the site to rebuild, adding the new post in to your post list and then auto-deploying to Netlify. Probably best hosted on Heroku or something similar (This is what I am building on my own at the moment).

I've tried a lot of different methods to try and support webmentions over on my website and this is the method I believe is the most sensible I've come across in terms of build time impact and separation of concerns.

voxpelli commented 6 years ago

👋 Happy to answer questions if there's any.

Apart from what's mentioned, there is the https://github.com/voxpelli/webpage-webmentions/issues/37 issue for my webmention.io alternative (https://webmention.herokuapp.com/) that would enable it to post received webmentions to micropub (which using my micropub-endpoint would then result in a comment being added to the page in Jekyll)

zachleat commented 5 years ago

Awesome related resource from @maxboeck https://mxb.at/blog/using-webmentions-on-static-sites/#webmentions

maxboeck commented 5 years ago

@zachleat I was wondering if something like this could be abstracted into a plugin, similiar to Aarons Jekyll solution (https://aarongustafson.github.io/jekyll-webmention_io/) - but as far as I can see eleventy plugins can't provide global JS data... 🤔

Might be something for a future release?

maxboeck commented 5 years ago

FYI: I made a starter template based on eleventy-base-blog that adds basic support for incoming webmentions via webmention.io:

https://github.com/maxboeck/eleventy-webmentions

vipickering commented 5 years ago

@maxboeck if you need any inspiration I wrote a blog post here that could help: https://vincentp.me/articles/2018/11/14/20-00/ I've implemented my own solution similar to @voxpelli that is running on Node.Js and Heroku. You could probably (fairly easily) abstract this out in to lambda functions if you wanted. for eleventy.

I'm using Jekyll at the moment (moving very soon to 11ty). Most of what I have is platform agnostic.

Ryuno-Ki commented 5 years ago

Count me in! I'm currently in the process of inheriting webmention-tools from @vrypan (see https://github.com/vrypan/webmention-tools/issues/16#issuecomment-479861045 ), which is written in Python. I would like to self-host the server side component as Python script on my own server (using uberspace.de shared hosting).

Thanks for the links above :-)