WordPress/Data

From IndieWeb
Jump to: navigation, search

In order to ensure interoperability between Indieweb WordPress plugins, as much as possible, the same data structures should be used.

Contents

Metadata

WordPress allows for for metadata to be attached to various objects.

By default, WordPress includes a metadata table for post types(posts, pages, etc), comments, taxonomy terms, and users.

WordPress contains a Metadata API that it uses to handle metadata.

Microformats data

Originally proposed by Ryan Barrett, store top-level microformats2 properties in metadata with the property names as the keys, prefixed by mf2_.

In accordance with MF2 JSON format, all values MUST be specified as arrays, even if there is only one value, identical to the Microformats 2 JSON format. This was implemented in the latest version of the Micropub plugin.

For example, this RSVP snippet:

<data class="p-rsvp" value="yes">I'm in!</data>

would be stored in post meta with the key mf2_rsvp and value yes.

Brainstorming

use uf2 instead of mf2

Tantek Çelik minor revision of Ryan Barrett's proposal - same but use "uf2" instead of "mf2" because the "u" looks closer to a µ for "micro":

why mf2 is better than uf2

Per Ryan Barrett's follow-up in IRC:

  • mf2 is seen in existing code much more often than uf2
    • e.g. php-mf2, mf2py, mf2util, etc
  • mf2 is more obvious (and maybe less clever)

Post

The Micropub and Post Kinds plugin currently store MF2 properties using the above prefix. Micropub uses the MF2 JSON guidelines of storing everything as an array, and Post Kinds has not yet adopted this, only storing multi-value properties as arrays.

The Syndication Links plugin stores its data in mf2_syndication and is cross-compatible.

User

WordPress supports user metadata. As part of the revamping of the Indieweb plugin, metadata reflecting rel-me and reflecting h-card properties were added to the user profile.

However, the rel-me silo URLs were not prefaced with mf2_ as using just the sitename...e.g. twitter instead of mf2_twitter allows for cross compatibility with other plugins that store this data. There were issues with those, due to standardization issues amongst different plugins.

Comment

Webmention Plugin adds an additional comment type of 'webmention' to comments.

Semantic Linkbacks stores extra information in the comment metadata.

  • semantic_linkbacks_canonical - the canonical source url
  • semantic_linkbacks_avatar - the author avatar URL
  • semantic_linkbacks_type - the comment type. The plugin currently supports the following types:
    • mention(default)
    • reply
    • repost
    • like
    • favorite
    • tag
    • rsvp:yes, rsvp:no, rsvp:maybe, rsvp:invited, rsvp:tracking.
  • As of Version 3.4.0, Semantic Linkbacks stores various parsed properties in comment meta using the mf2_ prefix. It basically stores everything that isn't expressly blacklisted, such as properties which are converted into WordPress properties.

Syndication

David Shanske's Syndication Links plugin uses the property mf2_syndication if it exists.

It previously used a single data field with the key 'syndication_urls' with URLs separated by newlines for syndication URLs to be marked up for syndication, before that, the plugin formerly stored an array of URLs of various syndication services under the metadata key 'synlinks'. This is now deprecated and if it finds these properties, it will move and delete the old.

Comment Data Brainstorming

Built into the WordPress Comment Database, the following relevant properties are stored:

  • comment_author - Name of the Author of the 'comment'
  • comment_author_url - While officially the author_URL, this is used by Pingbacks, Trackbacks, and Webmentions to reflect the source URL for a linkback, which creates an issue
  • comment_type - comments are stored as , otherwise name of type. 'webmention' is a custom type used by the Webmention Plugin
  • user_id - Theoretically, the comment author and such could be stored as a user in the user table. But this is not done by everyone.

Avatar/Author photos by default in WordPress is derived from Gravatar. The WordPress Webmention plugin does not modify this in any way, but Semantic Linkbacks sets an external URL for the avatar. There are multiple plugins for local avatar storage, but they only store photos for users, not for commenters.

Possible storage structure

  • For webmentions, source could be stored in metadata as 'mf2_url' keeping the practice of the object being the top-level microformat element.
  • Being as comment_author_url is used for source, actual author URL could be kept in mf2_author.
  • The author could either be stored in the comment metadats or a new subscriber role user created to store it.

Location

WordPress currently provides a Geodata data structure.

  • geo_latitude REQUIRED
   (float) decimal degrees -90 to 90 (negative values are in the southern hemisphere). 
  • geo_longitude REQUIRED
  (float) decimal degrees -180 to 180 (negative values are in the western hemisphere). 
  • geo_altitude OPTIONAL
  (int) Not part of the WordPress standard
  • geo_public OPTIONAL
  (int) is the geodata public (1) or private (0)? If value is missing, assume public. 
  • geo_address OPTIONAL
    (string) freeform textual description of coordinates. 
   "221B Baker St, Westminster, London NW1 6XE, UK", 
   "Pasadena, CA", "Soho, NYC", "Idaho", etc. 
   Accuracy level and language is arbitrary. 

As of WordPress 4.4, taxonomy term metadata is allowed to attach to a taxonomy term. Therefore, David Shanske is planning to declare a venue as a taxonomy term, and add location properties as taxonomy term meta attached to them.

Taxonomies

A taxonomy called 'kind' is currently used for the Post Kinds Plugin. This is meant to indicate the post kind. Several kinds are in use and/or reserved for future use due no UI for them having yet been built.

Post Kinds Plugin

In response to Ryan Barrett's proposal to organize using mf2_ as a key prefix, David Shanske changed to using 'mf2_cite' as a key instead of 'response'. All fields are optional(See Below)

  • mf2_cite
    • ['url'] - The URL the post is responding to.
    • ['name'] - The title of same
    • ['author'] - The URL of an h-card (if external)
    • ['published'] - URL publish date in ISO8601 with timezone offset
    • ['updated'] - URL updated date in ISO8601 with timezone offset
    • ['publication'] - The name of the site, or for citing articles in publications with more than one author.
    • ['content'] - the content or partial content of the work itself.
    • ['card']['name'] = Author Name / Artist Name
    • ['card']['photo'] = Author photo
  • mf2_in-reply-to, mf2_like-of, mf2_repost-of are now supported as URL properties. Any details are still stored in mf2_cite.
  • mf2_dt-start and mf2_dt-end to indicate duration
  • mf2_duration is deprecated in the interface, but will still be used in lieu of dt-end minus dt-start if set.

Deprecated

The Post Kinds Plugin, prior to Version 1.2.0,used the following array of metadata using the key 'response' to store details on what a post is responding to. All fields are optional.

  • response['url'] - The URL the post is responding to.
  • response['title'] - The title of same
  • response['author'] - The author name
  • response['icon'] - The author icon/image/avatar
  • response['published'] - URL publish date in ISO8601 with timezone offset
  • response['content'] - Content or a Citation...to allow for an excerpt for context.

Themes

Both David Shanske's mf2_s fork and  Matthias Pfefferle's SemPress theme register theme support for 'microformats2'. This allows both themes to tell plugins and other functions that they support the microformats2 standard and to act appropriately.

This usually means workarounds such as adding in microformats by the plugin can and should be disabled if this is set.


WordPress
Topics Getting Started on WordPressAdvanced WordPress Set UpPluginsThemesExamplesWordPress with BridgyDevelopmentDataSecurity
Primary Plugins Indieweb PluginWebmentionSemantic LinkbacksMicropubIndieAuthPost KindsSyndication LinksWebSub plugins
POSSE Plugins Social Network Auto PosterJetPack PublicizeBridgy PublishWP CrosspostTumblr CrosspostrMediumDiasposter
PESOS Plugins Keyring Social ImportersDsgnWrks Twitter ImporterDsgnWrks Instagram Importer
Other Plugins Webmention for (Threaded) CommentsIndieWeb Press ThisWordPress uf2OpenIDSimple LocationIndieweb ActionsPressForwardWhisperFollowblogroll2email
Themes SemPress • (SemPress Child Themes: SemPress Lite, SenPress, and Index) • ZenPressIndependent Publishermf2_s
Assistance Join the #indieweb chatIRC and other chat optionsWordPress Outreach ClubTroubleshooting TipsWordPress channel
See Also WordPress related wiki pagesWordPress.comAWS Tutorial


See Also

Personal tools
Namespaces
Variants
Actions
Recent & Upcoming
Resources
Toolbox