(wip)
...
adding webmentions to neocities
notes about getting this webmentions thingy up and running on my neocities site. it should also work on nekoweb or any other static host.
(it's worth mentioning at this point that i highly doubt im not sure this will work on a free Neocities account because of their security policy, unless it can be done in an iframe. im on a supporter account so it should be ok for now.)
of course it's been done before, but i want to understand it myself:
- daily-dev-tips.com: Goodbye comments, welcome Webmentions
- webmentions.neocities.org
hosted services
it's inevitably going to require some third-party service because you can't persist data on Neocities (no server-side scripting or database engine.)
- webmention.io hosted webmention collection service (endpoint) which can then be queried by API
- brid.gy checks social networks (bluesky, mastadon) for comments/likes about your URL and forwards them on to your web site (endpoint) as webmentions
so far...
1. registered for webmention.io
i found the easiest way to login was to prove ownership of my URL by email (add rel="me" to your mailto link:)
<a rel="me" href="mailto:worldwideshen@yahoo.com>email me</a>
2. added endpoint discovery meta tag
the tag needs to go in the <head> of every page that wants to collect webmentions:
<link rel="webmention" href="https://webmention.io/your-domain/webmention" />
your endpoint url is issued by webmention.io after you register.
i have two web sites so my meta tags are: <link rel="webmention" href="https://webmention.io/worldwideshen.neocities.org/webmention" />
<link rel="webmention" href="https://webmention.io/sheninorbit.nekoweb.org/webmention" />
and BOOM, im collecting webmentions! or, rather, i have the ability to collect webmentions. feels good, man.
so what next? just sit back and wait for webmentions to arrive? no sir, i think not!
3. connect brid.gy
it occurs to me that only a few days ago i had a short discussion with some friends over on bluesky about one of my new web pages. if i had a copy of that conversation as a list of webmentions i could display it directly on the page.
so, i: registered for brid.gy, told it about my URLs (neocities, nekoweb) and social networks (mastadon, bluesky), and then waited for the webmentions to roll in...
and well, it worked! my webmention.io account is now full of data downloaded from bluesky!
here's a JSON feed containing real, actual mentions about my football page:) https://webmention.io/api/mentions.jf2?&target=https://worldwideshen.neocities.org/football/
so i guess the next step is to display it on the page...
4. disappear and write code for three hours
wtf! it only works! i wrote code to do something! feels good, man.
ok, the code is prototype-quality at best, but here are the webmentions for this very page collected this morning:
hmm, ok two of the likes are in fact spam. but the first comment from Poylducks (the one about spam!) is real and comes from one of my actual neocities pals. how cool is that!?
(the spam was all posted on bluesky, im not sure if theres a way to prevent it getting in the system, but i can delete it from webmention.io... but at least ive got some test data.)
and here are the webmentions about my (fun, unique!) football page:
there are some issues here, but it seems to have loads of potential. i think i'll break for a moment to reflect on what (if anything) we've actually achieved today.
(some of) the issues:
- the spam (for now, delete it)
- the weird ???? question marks. these were unicode emoji we posted on bluesky that didn't survive the journey (for now, regex it out)
- the weird dates on the football thread. this is because likes don't have a published date, only webmention dates. my webmentions only started this morning but contained older data, so some of the dates are wrong (for now, ignore or dont show dates on likes)
- i don't understand how replies work. one of the threads above shows my reply, but the other doesn't and i don't know why (for now, wait for more data)