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

New webmention! #475

Closed
qubyte opened this issue Feb 25, 2022 · 0 comments
Closed

New webmention! #475

qubyte opened this issue Feb 25, 2022 · 0 comments

Comments

@qubyte
Copy link
Owner

qubyte commented Feb 25, 2022

{
  "source": "https://www.synesthesia.co.uk/note/2022/02/21/webmentions-revisited/",
  "target": "https://qubyte.codes/blog/dispatching-webmentions-with-a-netlify-build-plugin",
  "private": false,
  "post": {
    "type": "entry",
    "author": {
      "type": "card",
      "name": "Julian Elve",
      "photo": "",
      "url": "https://www.synesthesia.co.uk/author/julian-elve/"
    },
    "url": "https://www.synesthesia.co.uk/note/2022/02/21/webmentions-revisited/",
    "published": null,
    "wm-received": "2022-02-21T18:42:42Z",
    "wm-id": 1354314,
    "wm-source": "https://www.synesthesia.co.uk/note/2022/02/21/webmentions-revisited/",
    "wm-target": "https://qubyte.codes/blog/dispatching-webmentions-with-a-netlify-build-plugin",
    "name": "Webmentions revisited #",
    "photo": [
      "https://www.synesthesia.co.uk/author/julian-elve/avatar_hu216cebfc71bfa4c1f3caea2fb462a59e_1571_250x250_fill_q90_lanczos_center.jpg"
    ],
    "content": {
      "html": "This is a very brief note for my own benefit - if you are even slightly interested I recommend following the links to find other authors who have done a much better job of explaining this!\n\n\n<p>I had previously displayed <a href=\"https://indieweb.org/Webmention#History\">WebMentions</a> on posts via a script that ran on each pageview, queried <a href=\"https://webmention.io/\">webmention.io</a> for mentions relevant to that page and rendered them - entriely based on the <a href=\"https://sebastiandedeyne.com/adding-webmentions-to-my-blog/\">original approach documented by Sebastian de Dyne</a>.</p>\n<p>In the most recent iteration of changes I have:</p>\n<ul><li>adapted the processing of inbound webmentions so they are pulled periodically into data files in the repo by Github actions, then processed when the site is built so they are baked into the rendered static pages</li>\n<li>added a Netlify build plugin to push outgoing webmentions from my site to the sites I link to</li>\n</ul><h2>Processing inbound web mentions</h2>\n<p>Key elements:</p>\n<ul><li>a Github action that runs every thirty minutes and calls a retrieval script</li>\n<li>the retrieval script which pulls webmentions from <a href=\"https://webmention.io/\">webmention.io</a> and stores them as data files in the source repo for the site</li>\n<li>a processing script that is run each time the site is built - this reads the raw webmentions and processes them into a form suitable for Hugo to digest</li>\n<li>changes to page layouts to render a webmentions section</li>\n</ul><p>For all of this I am indebted to <a href=\"https://rowanmanning.com/posts/webmentions-for-your-static-site/\">Rowan Manning’s approach</a>.</p>\n<h2>Sending web mentions when the site is built</h2>\n<p>This is the other side of the coin. There are a range of approaches, but I decided to go with a Netlify build plugin <a href=\"https://www.netlify.com/blog/2021/05/06/now-available-configure-build-plugins-by-deploy-context/\">configured to only run on production builds</a>.</p>\n<p>All the examples I could find work by processing the RSS feed for the site, and most take the approach of posting webmentions for any remote sites linked from the last (or a configurable last number of) posts. This will fall down if you ever create more than one post in between publishes - rare but not impossible.</p>\n<p>I then found the approach documented by <a href=\"https://qubyte.codes/blog/dispatching-webmentions-with-a-netlify-build-plugin\">Mark Everitt</a> which compares the RSS feed before and after the build and pushes webmentions for all new items, and have adapted <a href=\"https://github.com/qubyte/qubyte-codes/tree/main/plugins/dispatch-webmentions\">his code</a>.</p>\n<h2>Other things</h2>\n<p><del><em>A note to myself - new functionality based on code developed by others, I need to spend some time to make the repo for this site openable, then make it public.</em></del>\nnow done - <a href=\"https://github.com/synesthesia/site2019\">here</a></p>",
      "text": "This is a very brief note for my own benefit - if you are even slightly interested I recommend following the links to find other authors who have done a much better job of explaining this!\n\n\nI had previously displayed WebMentions on posts via a script that ran on each pageview, queried webmention.io for mentions relevant to that page and rendered them - entriely based on the original approach documented by Sebastian de Dyne.\nIn the most recent iteration of changes I have:\nadapted the processing of inbound webmentions so they are pulled periodically into data files in the repo by Github actions, then processed when the site is built so they are baked into the rendered static pages\nadded a Netlify build plugin to push outgoing webmentions from my site to the sites I link to\nProcessing inbound web mentions\nKey elements:\na Github action that runs every thirty minutes and calls a retrieval script\nthe retrieval script which pulls webmentions from webmention.io and stores them as data files in the source repo for the site\na processing script that is run each time the site is built - this reads the raw webmentions and processes them into a form suitable for Hugo to digest\nchanges to page layouts to render a webmentions section\nFor all of this I am indebted to Rowan Manning’s approach.\nSending web mentions when the site is built\nThis is the other side of the coin. There are a range of approaches, but I decided to go with a Netlify build plugin configured to only run on production builds.\nAll the examples I could find work by processing the RSS feed for the site, and most take the approach of posting webmentions for any remote sites linked from the last (or a configurable last number of) posts. This will fall down if you ever create more than one post in between publishes - rare but not impossible.\nI then found the approach documented by Mark Everitt which compares the RSS feed before and after the build and pushes webmentions for all new items, and have adapted his code.\nOther things\nA note to myself - new functionality based on code developed by others, I need to spend some time to make the repo for this site openable, then make it public.\nnow done - here"
    },
    "mention-of": "https://qubyte.codes/blog/dispatching-webmentions-with-a-netlify-build-plugin",
    "wm-property": "mention-of",
    "wm-private": false
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant