Regarding the disclaimer "WARNING: Open Graph is modern spyware. You should use this if and only if you don't mind making the readers of your wiki/blog being tracked by evil corporations without their consent. By using this plugin you are being mean to the people who are reading your content. You have been warned."
I have looked up how open graph is described to work, and don't see how this can be considered spyware. All it seems to do is enable to control how shared links are displayed on social networks that implement the protocol, and possibly on those platforms determine how many times a link to my site would be shared a little more easily, but there doesn't seem to be a way readers of my site would be tracked thanks to the metadata on the wiki. Even if they are users of social networks and logged in there, their browsing of my site won't be tracked after open graph metadata is included. Is that incorrect?
I've been implementing this by hand in my page.tmpl template here:
<meta property="og:title" content="<TMPL_VAR TITLE>" />
<meta property="og:description" content="<TMPL_IF DESCRIPTION><TMPL_VAR DESCRIPTION><TMPL_ELSE><TMPL_VAR WIKINAME></TMPL_IF>" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="<TMPL_VAR WIKINAME>" />
<!-- until https://ikiwiki.info/forum/how_to_put_a_permalink_on_each_post/#comment-adac5fa63a3724c4719188c9858f239d
AKA https://gitlab.com/anarcat/ikiwiki/-/commit/c2e63cbd195db95115fe4e1e1ef591bfdf290135
gets merged, my domain is harcoded here -->
<meta property="og:url" content="https://anarc.at/<TMPL_VAR PAGE>" />
<!-- this can be overriden per page in the META section above, first seem to take precedence -->
<meta property="og:image" content="https://anarc.at/apple-touch-icon.png" />
The trick, from there, is to use the following ?meta entries in the page to tweak things:
[[!meta title="This blog post title"]]
[[!meta description="This is an example description of an eventual blog post you'd want a description of"]]
[[!meta name="image" property="og:image" content="/cool-image.jpg"]]
The image bit only works if:
- you have the htmlscrubber plugin disabled (which is... not great)
- the
<TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>block is above theog:imageproperty shown above - if OpenGraph parsers all consistently serve the first
og:imageit finds (I just tested this on https://www.opengraph.xyz/
Here it renders as this:
<meta name="description" content="This is a test page" />
<meta name="image" property="og:image" content="/night_city/bg_header.jpg" />
<title>Sandbox - anarcat</title>
<meta property="og:title" content="Sandbox" />
<meta property="og:description" content="This is a test page" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="anarcat" />
<!-- until https://ikiwiki.info/forum/how_to_put_a_permalink_on_each_post/#comment-adac5fa63a3724c4719188c9858f239d
AKA https://gitlab.com/anarcat/ikiwiki/-/commit/c2e63cbd195db95115fe4e1e1ef591bfdf290135
gets merged, my domain is harcoded here -->
<meta property="og:url" content="https://anarc.at/sandbox" />
<!-- this can be overriden per page in the META section above, first seem to take precedence -->
<meta property="og:image" content="https://anarc.at/apple-touch-icon.png" />
So there's two property="og:image" there which isn't great, but I couldn't figure out how to parse out the META variable from HTML::Template (it's likely impossible at that level) to avoid duplication.
It would be better if we could have a more generic image meta here that would Just Do The Right thing. We could even add the og: stuff to the basic template to simplify things, and it would remove the need to disable the htmlscrubber plugin.
-- anarcat