I bumped up a little plugin for my site that generates rewrite URLs for avatar images. So if you visit /avatar/username you get redirected to the avatar for that username. You can add ?s=250 to pass the size to the other side. This is the same query used by Gravatar. Right now, this calls the gravatar URL and does a temporary redirect to it, setting cache control headers to save the redirect. This means that there could be up to two http queries per avatar image. In a future version, I might actually serve the avatar locally. I got tired of broken URLs for my image. Now, the same link will always produce my image.

Post Kinds 3.4.0 Released

Post Kinds 3.4.0 was released. If I broke your site, I’m sorry. Please tell me so I can fix it. I tried to cover everything, but I wrote a lot of the storage code and will have to continue to do so in preparation for the next iteration at some point in the future.

A lot of the code focused on fixing the storage and display of media. Whenever you save a post, your content is searched for image, video, and audio tags. If there are any, it will ignore anything in these properties sent by Micropub or saved otherwise. If it finds none, it will. This should hopefully reduce duplicate displays.

Shortly after 3.4.0 went out, I found another bug, so quickly released 3.4.1. If additional bugs are found, I’ll quickly iterate.

Converting Your WordPress Theme for Microformats 2 Part 2

Okay, so four years after I wrote how to start Converting Your WordPress Theme for Microformats 2, I’m back with Part 2.

First, four years later, we need to recap, update, and expand what we discussed last time.

Before you start, you need to clean up two very simple things.

  •  Don’t style any Microformats Classes. WordPress commonly supports classic microformats. WordPress actually adds hentry, the predecessor to h-entry, into every single post in the post_class filter. So, you want to be able to supplement, replace, or fix Microformats classes without changing the look of your theme. So if you are updating a theme that already does this, add a styling class and change your CSS to do that. For example, I add entry alongside hentry and rewrite all the CSS to style entry, then I can take hentry out where it shouldn’t be.
  • Someone years ago decided to add hfeed to the header file of their theme and everyone copied it. hfeed indicates a page is a feed…which means it contains multiple entries(date archive, author archive, main posts page, etc). This should therefore not appear on a single page…so if it does, take it out.

Where do you start?

Add h-entry and h-feed in the proper places. See Part 1 for some sample code on how to do that using the body_class and post_class filters. You could also add it manually by surrounding your post, class="h-entry", and surrounding all the posts in an archive/feed page with an element that has class="h-feed" Congratulations, you’ve now marked up your posts as posts and your feeds as feeds.

Now that we’ve marked up feeds and posts, we want to get down deeper…namely, inside your posts. We want to mark up things like author, publish date, etc.

In most themes, time is already marked up, something like this, with an HTML5 time element. The full time is present in ISO8601 format, with the timezone offset for your site, and inside the tag is the human readable one.

<time datetime="2016-06-22T23:52:09-04:00">June 22, 2016</time>

You get two times per post..the published time and the updated time.  Many themes have the updated time visually hidden, but available for parsing. If you do not have a fully formatted timestamp in datetime, you should do so. Positively, since WordPress 5.3, the offset is properly set based on your site settings, where previously you had to edit the theme to get this. The displayed time is up to you.

Add class="dt-published" to the publish time of the post, and class="dt-updated" to the updated/modified time of the post.

We also, most importantly, want to make sure the author is marked up correctly. That should include, at minimum, the author’s name, if not URL and photo. All author properties should be surrounded by an element that has class="p-author h-card". The photo should have class="u-photo", indicating it is a representative photo of the element it is inside…the h-card. H-cards represent people, organizations, or places. By adding the p-author, we indicate that this person is the author of the piece. The p- tells the parser that whatever text is inside here is the value of the author property. You can also add a url for the author website, marking it class="u-url" which states it is the URL that represents the containing element…the h-card/author property.

Here is a simplified example of what this might look like…

<div class="h-entry">
<time class="dt-published" datetime="2016-06-22T23:52:09-04:00">June 22, 2016</time>
<span class="p-author h-card"><a class="u-url" href="https://joebloggs.com">Joe Bloggs</a><img class="u-photo" src="https://joebloggs.com/avatar.jpg" /></span>
</div>

So, if we run the new file through a Microformats parser(I like php.microformats.io), we’d get a nice output…

{
   "type": [
     "h-entry"
    ],
   "properties": {
     "url": [
       "https://joebloggs.com"
     ],
     "published": [
       "2016-06-22T23:52:09-04:00"
     ],
     "author": [
       {
         "type": [
           "h-card"
         ],
         "properties": {
           "photo": [
             "https://joebloggs.com/avatar.jpg"
           ],
           "name": [
             "Joe Bloggs"
           ]
         },
         "value": "Joe Bloggs"
         }
     ]
  }
}

Looks pretty good…except no content… Content is a bit more complicated, because WordPress stores content in the database, but when outputting it, puts it through a filter called “the_content”, which many plugins use to add things that aren’t content to the post.

Content is supposed to be wrapped in an element with the class="e-content". If we wrap the output of the_content, we might incorporate things from other plugins.

While it is by no means the most reliable way, my solution is to use the same content filter, but at the first priority, wrapping what original came out of post_content before all the other items.

You can do the same with the summary, if it exists, wrapping it in p-summary.

function add_econtent( $content ) {
  // Do Not Add this is it is a Feed.
  if ( is_feed() ) {
    return $content;
  }
  $wrap = '<div class="e-content">';
  // If there is no content, do not bother.
  if ( empty( $content ) ) {
    return $content;
  }
  return $wrap . $content . '</div>';
}
add_filter( 'the_content', 'add_econtent', 1 ); 

function add_psummary( $excerpt ) {
  // Do Not Add this is it is a Feed.
  if ( is_feed() ) {
    return $excerpt;
  }
  $wrap = '<div class="p-summary">';
  // If there is no excerpt, do not bother.
  if ( empty( $excerpt ) ) {
    return $excerpt;
  }
  return $wrap . $excerpt . '</div>';
}
add_filter( 'the_excerpt', 'add_psummary', 1 );

In the next part, we’ll dive even more into the weeds, talking about other classic microformats and rel-values and what to do with them. Probably before 2024.

Tonight begins Yom Kippur, and for the first time in my life, I will not be at services. There was no option, due to lack of committed individuals and rain, for an outdoor service, and I’m still uncomfortable with the way they are not distancing inside. So I will be fasting and praying at home. There is a very different feel to solo prayer than group prayer and Yom Kippur feels different than praying at home alone on Passover, which I also did. I am pleased that we were able to get services outside available for Rosh Hashanah. If Rosh Hashanah is, akin to a trial, the verdict, Yom Kippur is the final appeal before the sentence is carried out for the next year. In a year that included so many difficult things, and the challenges of the current situation the world finds itself in…most of us cannot imagine this continuing till next Yom Kippur. Here is hoping things will look better soon.

Fall Foliage Trip

Today, I took a little fall foliage trip up to Delaware County. This complimented a previous, shorter trip to Calicoon and Narrowsburg and yesterday’s trip out to the Neversink Reservoir.

The trip took me down to Route 55, then to Route 17B, and on to Route 97 straight into Hancock. From Hancock, we took Route 268 to Route 10, to Route 206, to Downsville NY, then Route 206 back to Route 17(Future I-86)..but instead of getting back on, we took the scenic route around Swan Lake back to where we started.

Route 55 actually starts at Route 97 in Barryville, NY. The goal was to hug the water as much as possible, but taking 55 to its terminus with 97 would have taken me too far south.  So, Route 55 to White Lake, NY where I turned onto Route 17B.

Route 17B runs from Monticello to Callicoon. At Callicoon, we joined Route 97, which runs mostly along the Delaware from Port Jervis to Hancock. So, a lot of this route included picking up or taking roads to their end. Route 97, which was designated as the Upper Delaware Scenic Byway by FDR, is where we pick up the Delaware River, and parallel it and the railroad tracks through Long Eddy before moving from Sullivan County into Delaware County.

Heading into Downtown Hancock, we stopped for a scenic overlook, then turned onto Route 268, which starts in Hancock and runs along and then over the Cannonsville Reservoir. The Cannonsville Reservoir is the westernmost and the newest of New York City’s reservoirs, placed into service in 1964.  Cannonsville itself ceased to exist as a result.

Route 268 ends at Route 10, which starts 20 miles away in Deposit, which was a potential part of this route and may be the location of a future trip.

NY Route 10 continues from the reservoir to Walton NY, once again on the banks of the Delaware where it meets up with Route 206, which we took to its terminus in Roscoe, NY with Route 17(Future I-86).

Route 206 after Walton crosses the West Branch of the Delaware River and heads toward Downsville. We stopped at the Downsville Covered Bridge, built 1854, for a photo op, then returned to Route 206 past the Pepacton Reservoir which was completed in 1955.

Both Cannonsville and Pepacton empty into the Rondout Reservoir, as does the Neversink Reservoir I visited yesterday. The three reservoirs I visited collect here before headed to New York City via the Delaware Aqueduct, the newest of the three aqueducts that from the NYC water system and provide 50% of NYC’s water supply.

After the reservoir, we continued on Route 206 across the Beaver Kill en route back, passing through Roscoe…Trouttown USA….a mecca for fly fisherman, including Donald Trump Jr(who I have not seen there, nor am I interested in seeing).

All in all, the trip took 3 hours of driving.

 

 

 

Fall Foliage Part 2

On Thursday, continued with the drive, taking another wide loop through Sullivan, Orange, and Ulster counties, completing a circuit of the Delaware Aqueduct reservoirs.

We took off through the village of Liberty, routing on Route 52 and Route 42 via Loch Sheldrake to Grahamsville, NY.

Loch Sheldrake was the site of Brown’s Hotel, which I stayed at as a kid. The resort hotels of the Catskills are a topic I could cover in a lot more detail, as it is a unique but also sad story. The Brown’s closed in the late 80s. It was converted into condos in the late 90s, and burned down in 2012.

The southern segment of Route 42 terminates at Route 55 near the Rondout Reservois, however, it used to continue north past this point. There is a portion of Route 42 further north that is no longer connected to the main southern segment.

Grahamsville NY is the site of the Little World’s Fair, the longest running independent fair in the state of New York, having been held since 1878. In 2020, due to the pandemic, the fair was cancelled for the first time since 1928, when the bridge to the fairgrounds was washed out.

Route 55 from Grahamsville heads out along the southern shore of the Rondout Reservoir. Route 55A is a loop around the other side of the same reservoir, and may be included in a future short trip.

Leaving the reservoir area and crossing into Ulster County, we headed through to the village of Napanoch, where we headed onto US Route 209.

From Port Jervis to Kingston, Route 209 runs along the former route of the D&H Canal, which was built in the 19th century, linking the Delaware River at Port Jervis with the Hudson River at Kingston and allowing coal from Pennsylvania to reach New York City. Ultimately, the railroads caused it to be abandoned by the beginning of the 21st century. Various parts of the canal exist as parks and other scenic/historical sightseeing opportunities.

The journey on Route 209 took us through Ellenville, which is part of the Shawangunk Mountains Scenic Byway, which includes the next stretch of Route 209.

The road crosses back and forth between Sullivan and Ulster County.  At Wurtsboro, it intersects with Route 17(Future I-86), and passes Wurtsboro Airport, believed to be the oldest operating glider airport in the country.

We continued through to Port Jervis, circling the city and passing the restored 1892 Erie Railroad Depot. We did not pass the Tri-States Monument, which marks the intersection nearby of New Jersey, New York, and Pennsylvania.

From Port Jervis, Route 97, which we took part of earlier in the week, begins and follows the path of the Delaware River, at many points a winding cliffside route that includes a beautiful view of the river.  Taking this all the way to Barryville along the river, we meet up again with the start of Route 55, returning to origin.

Just released another minor bugfix for Post Kinds. This is the 7th in the last few weeks. The recent update, version 3.4, created a few issues, but also revealed some that were already there as I started actually checking more of the data I’ve been storing for a rainy day.

For example, I’m no longer doing backward compatibility retrieval on posts using the older storage formats, which, looking at older posts, means that some things are not displaying. I have been restoring the information to the posts by manually reparsing it, but I may have to release a version to do so automatically, as no one wants to go through old posts.

Fortunately, I don’t have that many, but I do need to make sure those who posted more aren’t subject to the same problem.