You're viewing old version number 42. - Current version

11 min

Add webmention client code to Junco

Dvlp to-dos (3oct2013)

  • investigate indieweb comments
    • why comments and webmentions?
  • [X] same source post URL can be posted only once to the target.
  • [X] create new get_blog_post subroutine check for target.
  • [X] webmentions can only be posted when the blog post contains the blog_username tag.
  • [X] add the webmention=no command to disable the option for a blog post.
  • [X] currently, webmentions will remain unavailable for microblog posts.
  • [X] look for the e-content microformat property on html5 section tag.

Microformats

using:
http://search.cpan.org/~gaas/HTML-Parser-3.71/lib/HTML/TokeParser.pm

https://eschnou.com/entry/testing-indieweb-federation-with-waterpigscouk-aaronpareckicom-and--62-24908.html

To get a webmention (source) reply post to appear at the target website, wrap the source post with an h-entry microformat
<div class="h-entry">
article post
</div>
another way:
<article role="article" class="h-as-note h-entry hentry note-single">
<section class="e-content">
article text
</section>
</article>
or this way:
<article class="entry h-entry entry-single flow wf">
<section class="e-content">
article text
</section>
</article>
from the microformats website:
<article class="h-entry">
  <h1 class="p-name">Microformats are amazing</h1>
  <p>Published by <a class="p-author h-card">W. Developer</a>
     on <time class="dt-published" datetime="2013-06-13 12:00:00">13<sup>th</sup> June 2013</time>
 
  <p class="p-summary">In which I extoll the virtues of using microformats.</p>
 
  <div class="e-content">
    <p>Blah blah blah</p>
  </div>
</article>

http://adactio.com/journal/6495/
I’m using that to check the cURLed source for any responses that have been marked up using h-entry. That’s one of the microformats 2 vocabularies—a much simpler way of writing structured content with microformats. Aaron, Amber, and Barnaby all sent responses that were marked up with h-entry so now their responses appear in full.

http://microformats.org/wiki/microformats2
http://microformats.org/wiki/h-entry


Access these tags and links:

update: 21Sep2013 - focus on these links initially:

Add to header.tmpl:

<meta name="author" content="Jeremy Keith" />
<link rel="webmention" href="http://adactio.com/webmention.php" />


old link list:

"The ability for one webpage to let another know the first has linked to the second is a vital indieweb building block.
The key mention technology for the indieweb is: webmention"

http://gist.github.com/adactio/6575229 - "The form I put at the end of every blog post I make so that you can ping my webmention endpoint with your response."

<form method="post" action="/webmention.php">
<p>Have you published a response to this?
<label for="webmention-source">Let me know the <abbr title="Uniform Resource Locator">URL</abbr></label>:
</p>
<input type="url" name="source" id="webmention-source">
<input type="hidden" name="target" value="http://adactio.com/journal/6495/">
<input type="submit" value="Ping!">
</form>

Sep 15, 2013 - Parsing webmentions

Understanding

I'm still trying to understand webmentions and pingbacks.

I guess that I viewed this more as a remote-commenting function.

  • Blogger A creates a post
  • Blogger B would like to "comment" on Blogger A's post, but A does not allow comments.
  • Blogger B can create a post that is responding to A, but unless B contacts A through e-mail or some other means, A will be unaware of B's blog response.
  • But if Blogger A supported some kind of remote commenting system, and maybe that could be webmention, then Blogger B could create a blog post and include the URL to Blogger A's post.
  • at the bottom of Blogger A's post would be Blogger B's blog post response title, which would be a link to Blogger B's reply post.
  • Blogger B can only create one blog post response for each blog post by A.

The above would work and display similar to my reply as a blog post function in my Kestrel code that was removed when I started over with the Junco codebase.

Maybe a remote comment procedure would send to the original blog post app:

  • reply blog post URL
  • reply blog post title
  • reply blog post author name/username that links to Blogger B's home page
  • reply blog post creation/published date (date sent to Blogger A)
  • an optional brief description or intro to the blog post, limited to x-number words or characters (Blogger A's software could set the char or word limit or not display the description at all)

Make it a POST request from Blogger B to Blogger A, and encapsulate the above info in JSON.

Could still be abused by spammers and trolls, unless Blogger A establishes a white list of users permitted to create blog replies. Blogger B would have to seek permission from Blogger A to be on the whitelist.

Webmention Protocol Summary

From http://indiewebcamp.com/webmention

Assuming Aaron's blog supports receiving webmentions, and Barnaby's blog supports sending webmentions:

  1. User Aaron posts a blog post on his blog
  2. User Barnaby writes post on his blog that links to Aaron's post.
  3. After publishing the post (i.e. it has a URL), Barnaby's server notices this link as part of the publishing process
  4. Barnaby's server does webmention discovery on Aaron's post to find its webmention endpoint (if not found, process stops)
  5. Barnaby's server sends a webmention to Aaron's post's webmention endpoint with
    source set to Barnaby's post's permalink
    target set to Aaron's post's permalink.
  6. Aaron's server receives the webmention
  7. Aaron's server verifies that target (after following redirects) in the webmention is a valid permalink on Aaron's blog (if not, processing stops)
  8. Aaron's server verifies that the source (when retrieved, after following redirects) in the webmention contains a hyperlink to the target (if not, processing stops)

Unmentioned but implied (and vaguely mentioned in the pingback spec):

  • Aaron's server displays the information about Barnaby's post somewhere on Aaron's post.

Own Your Comments
Proposed by Aaron Parecki

This session is about IndieWeb Commenting and feedback systems.
What does it mean to post a comment in an indie web? As the author of a comment, you should own and control it, most likely you should post it on your own site. But we still want to have the benefits of centralized commenting systems like seeing a list of all comments left on a post, filtering spam comments, etc.

One way to handle comments is through the pingback or trackback protocols, both of which are widely implemented in many major blogging platforms. We can discuss the merits and drawbacks of each, and other possible solutions. A workshop session could involve implementing trackbacks/pingbacks on your own site, or implementing a new mechanism for using them.

Also see: backfeed

Junco support 21Sep2013

Should the remote webmention information be posted in the content table as a microblog post?

If so, what about author id info? Create a generic "Webmention" account at JotHut?

Would I need to add one or more columns to the content database table to support webmentions?

If the info was stored as a microblog post, then in theory, I could still click the "replies" link at the top of the site.

Since at the moment, I do not plan to allow others to create accounts at JotHut, the "replies" link at the top of the site is meaningless. I have been using the reply feature on my microblog posts to add additional information or notes. I did not expect to use the reply mechanism for my own microblog posts, but it's a handy tool for quick-hitting notes that should are associated in a common thread.

If I don't store webmentions in the content table, then I would need to add an additional link to the top of the site that would display the list of recent remote replies.

The webmention table may need to store:

  • id
  • target = URL for my post at Jot Hut
  • source = remote URL for the response to my post
  • date = when the response was submitted to Jot Hut (not the date that the remote response or webmention was created by another person)
  • status = 'o' open for display

I should provide the ability to hide webmentions from displaying under my posts.

And I should add a blacklist of sites prohibited from creating a webmention.

The webmentions would not display by default under my posts at Jot Hut. I would treat this the same way that I do now with the built-in reply mechanism, which is to display a link, such as: webmentions: 8 that when clicked will show all the replies. Example:

http://jothut.com/cgi-bin/junco.pl/microblogpost/3904 - notes taken while watching the Browns-Dolphins game.

The above post displays something like this:


Miami, 2nd half, opening poss, 3rd and 11 own 16, pass inc. 3 and out. Punt. Ball downed at Clev 22. Good punter for Miami. #browns.

From JR's : micro blog
created on Sep 08, 2013 at 02:48:35 PM - # - replies: 95
reply


The "replies: 95" link must be clicked to display the replies for the post. That's different from a normal commenting system on a blog or message board, but webmentions is a different response mechanism.

With Jot Hut, I prefer to keep the display page for a blog or microblog focused on the content that I create. One additional click is not a hardship, in my opinion.

regex

http://www.perlmonks.org/?node_id=507660

Here is the regex to match the tag with attributes value.
m#<([^">]+(?:"[^"]+")*[^>]+)>#

another comment

m#
<             ## start with <
(             ## group start 
[^">]+        ## text but Not match " and >
(?:"[^"]+")*  ## if " found, match till end quote found. Its optional
[^>]+         ## text but Not match and >
)             ## group end 
>             ## End with >
#

http://www.codinghorror.com/blog/2009/11/parsing-html-the-cthulhu-way.html

Reply To - Comments

https://eschnou.com/entry/testing-indieweb-federation-with-waterpigscouk-aaronpareckicom-and--62-24908.html

http://indiewebcamp.com/comment

 <div class="entry-content e-content" property="schema:text sioc:content">
<p>Testing, testing, <a href="http://eschnou.com/entry/testing-indieweb-federation-with-waterpigscouk-aaronpareckicom-and--62-24908.html" rel="in-reply-to" class="u-in-reply-to">is this thing on?</a></p>
</div>

View this example reply post that appears in the same above thread at eschnou.com.
http://www.sandeep.io/32

Automate Webmentions

For webmention: If I want to automate my Junco code so that my source post (reply) is sent to the target, then I should include this class="u-in-reply-to" on the target URL when it's included in my source (reply) post.

When a microblog (note) or blog post (article) is created in Junco, the app would search for class="u-in-reply-to" within anchor tags, which would be targets. If found, then Junco would do a "get" on that target URL, read through the HTML, and search meta tag for a webmention URL program.

If the target has a webmention program, then Junco would send a POST request to that target's webmention program. The POST params would include URLs for target (the post that I'm replying to) and source (my reply post).

Once the POST request has been made, the target webmention app would return a status code, so that Junco can determine if success or failure or something else. Doesn't matter too much, since the source post still gets posted within the Junco app.

The target code would process the Junco post request, and add my source (reply) post to the thread or comment section of the target post. And if my source post contained h-entry and e-content info, then it's possible that some or all of my post would appear in the target's comment section.

A lot depends upon how the target app processes a webmention. Maybe after the Junco post request, and the target app has verified my source post, then my source post would go into a moderation queue and would not appear immediately in the comments section of the target page.

The target app may only display the source URL in the target's comment section and ignore the source's h-entry info.

The target may only display a snippet of the source's h-entry info, which is what I'm doing within the Junco app when the Junco app is receiving a webmention POST request (the Junco app is the target.)

If the target system does not supported automated webmentions (the target does not contain the webmentioni app in the meta tag), then maybe the target page contains the HTML form to allow a user to submit manually the source URL, which is what I'm doing now within Junco as of Oct 3, 2013.

Plus maybe the source software does not support auotmated webmentions. The source system may not scan its own source posts for links with the u-in-reply-to in order to send a POST request to the target. This is the current status for Junco as of Oct 3, 2013.

I'd like to automate Junco to send and receive webmention POST requests.

And I want to continue to supply the HTML form for manually submitting a webmention to a post within Junco.

#junco - #juncotodo - #indieweb - #comments

From JR's : articles
1993 words - 13329 chars - 11 min read
created on
updated on - #
source - versions

Related articles
In Progress - Add webmention client code to Junco - Oct 21, 2013
Syndicate JotHut.com posts to Twitter using the share button - Nov 01, 2013
Creating a Webmention blog reply post at JotHut - Oct 23, 2013
Reply to Cawr's post about publishers and UX - Jul 18, 2016
Webmention info to read again - Apr 02, 2014
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Dec 23, 2024 - 10:06 a.m. EST