Mastodon
  • What is Mastodon?
  • Using Mastodon
    • Signing up for an account
    • Setting up your profile
    • Posting toots
    • Using the network features
    • Dealing with unwanted content
    • Promoting yourself and others
    • Set your preferences
    • More settings
    • Using Mastodon externally
    • Moving or leaving accounts
    • Running your own server
  • Running Mastodon
    • Preparing your machine
    • Installing from source
    • Configuring your environment
    • Installing optional features
      • Full-text search
      • Hidden services
      • Single Sign On
    • Setting up your new instance
    • Using the admin CLI
    • Upgrading to a new release
    • Backing up your server
    • Migrating to a new machine
    • Scaling up your server
    • Moderation actions
    • Troubleshooting errors
      • Database index corruption
  • Developing Mastodon apps
    • Getting started with the API
    • Playing with public data
    • Obtaining client app access
    • Logging in with an account
    • Guidelines and best practices
    • Libraries and implementations
  • Contributing to Mastodon
    • Technical overview
    • Setting up a dev environment
    • Code structure
    • Routes
    • Bug bounties and responsible disclosure
  • Spec compliance
    • ActivityPub
    • WebFinger
    • Security
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • OAuth Scopes
    • Rate limits
  • API Methods
    • apps
      • oauth
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • suggestions
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
    • notifications
      • push
    • search
    • instance
      • trends
      • directory
      • custom_emojis
    • admin
    • announcements
    • proofs
    • oembed
  • API Entities
    • Account
    • Activity
    • Admin::Account
    • Admin::Report
    • Announcement
    • AnnouncementReaction
    • Application
    • Attachment
    • Card
    • Context
    • Conversation
    • Emoji
    • Error
    • FeaturedTag
    • Field
    • Filter
    • History
    • IdentityProof
    • Instance
    • List
    • Marker
    • Mention
    • Notification
    • Poll
    • Preferences
    • PushSubscription
    • Relationship
    • Report
    • Results
    • ScheduledStatus
    • Source
    • Status
    • Tag
    • Token

Microformats

An open data format using CSS classes to structure your already-existing HTML.

    • What are microformats?
    • Microformats classes
    • Additional classes

What are microformats?

Microformats 2.0 is a standard used to embed metadata directly within an HTML document. Rather than needing to use an API for read-only purposes, a web page can simply be parsed for certain CSS classes in order to extract information that you have already fetched simply by viewing the page, rather than having to separately request that same information from an API. The use of microformats classes allows for semantic parsing of data within a given web page, and can be used to generate feeds, cards, or representations of that data.

Microformats classes

All microformats classes use a prefix. The prefix indicates the type of the element, independent of hierarchy. These are the microformats classes as used in Mastodon’s codebase.

Root elements (h-*)

h-feed

Represents a stream of entries. Attached to a profile’s toots. Also attached to the parent thread within detailed status views.

h-entry

Represents episodic or date stamped online content. Attached to a status.

h-cite

Represents a reference to another online publication. Attached to a boost. Also attached to other statuses in the thread within detailed status views.

h-card

Represents a person or organization. Attached to the container of display name, username, and avatar. Also attached to mentions.

Plain-text properties (p-*)

p-author

Within h-entry or h-cite, represents the author of the entry, and is attached to the container of display name, username, and avatar.

p-name

Within h-feed, represents the title of the feed. Attached to data element with value attribute. Within h-entry or h-cite, represents the title of the entry. Unused in Mastodon. Within h-card, represents the plain-text name of a person or organization. Attached to display name.

p-in-reply-to

Within h-entry of a detailed status, represents the status that is the direct parent.

p-repost-of

Within h-entry of a detailed status, represents a post that is a reblog and also a direct parent. Currently unused, since reblogs cannot be replied to.

p-comment

Within h-entry of a detailed status, represents statuses that are direct children.

URL properties (u-*)

u-photo

Within h-card, represents the profile picture. Attached to the avatar image.

u-uid

Within h-entry or h-cite, represents a universally unique identifier. Attached to timestamp link.

u-url

Within h-entry or h-cite, represents the status permalink. Attached to timestamp link. Within h-card, represents the profile permalink. Attached to display name link.

Datetime properties (dt-*)

dt-published

Within h-entry or h-cite, represents the date and time at which the status was published. Attached to data element with value attribute.

Element tree (e-*)

e-content

Within h-entry or h-cite, represents the content of the status. Attached to status content.

Additional classes

These elements are attached by Mastodon for parsing metadata, but are not technically part of the Microformats vocabulary.

mention

Indicates that the link should be opened in-app with the associated mention data from the API.

hashtag

Indicates that the link should be opened in-app with the associated hashtag data from the API.

Last updated January 12, 2020 · Improve this page

Sponsored by

Dotcom-Monitor LoadView Stephen Tures Swayable

Join Mastodon · Blog · ·

View source · CC BY-SA 4.0 · Imprint