Mastodon
  • 什么是 Mastodon?
  • 使用 Mastodon
    • 注册帐户
    • 设置你的个人资料
    • 在你的账户发布内容
    • 使用网络功能
    • 处理不想看到的内容
    • 推广你和他人
    • 进行偏好设置
    • 更多设置
    • 在站点外使用 Mastodon
    • 迁移或离开账户
    • 运行你自己的站点
  • 运营 Mastodon
    • 准备你的服务器
    • 从源代码安装
    • 配置你的环境
    • 安装可选功能
      • 对象存储
      • 洋葱服务
      • 验证码
      • 单点登录
    • 配置全文搜索
    • 设置你的新实例
    • 使用管理 CLI
    • 升级到新版本
    • 备份你的服务器
    • 迁移到新机器
    • 扩大你的站点规模
    • 审核操作
    • 故障排除
      • 数据库索引损坏
    • 用户组
  • 开发 Mastodon 应用
    • API 入门指南
    • 使用公开数据
    • 获取客户端应用访问权限
    • 使用帐户登录
    • 库与实现
  • 向 Mastodon 项目做贡献
    • 技术概览
    • 设置开发环境
    • 代码结构
    • 路由
    • 漏洞赏金与责任披露
  • 遵循的标准
    • ActivityPub
    • WebFinger
    • 安全性
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • Datetime 格式
    • 指南与最佳实践
    • OAuth 令牌
    • OAuth 作用域
    • 速率限制
  • API 方法
    • apps
      • oauth
      • emails
    • accounts
      • bookmarks
      • favourites
      • mutes
      • blocks
      • domain_blocks
      • filters
      • reports
      • follow_requests
      • endorsements
      • featured_tags
      • preferences
      • followed_tags
      • suggestions
      • tags
    • profile
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
    • grouped notifications
    • notifications
      • push
    • search
    • instance
      • trends
      • directory
      • custom_emojis
      • announcements
    • admin
      • accounts
      • canonical_email_blocks
      • dimensions
      • domain_allows
      • domain_blocks
      • email_domain_blocks
      • ip_blocks
      • measures
      • reports
      • retention
      • trends
    • proofs
    • oembed
  • API 实体
    • Account
    • AccountWarning
    • Admin::Account
    • Admin::CanonicalEmailBlock
    • Admin::Cohort
    • Admin::Dimension
    • Admin::DomainAllow
    • Admin::DomainBlock
    • Admin::EmailDomainBlock
    • Admin::Ip
    • Admin::IpBlock
    • Admin::Measure
    • Admin::Report
    • Announcement
    • Appeal
    • Application
    • Context
    • Conversation
    • CustomEmoji
    • DomainBlock
    • Error
    • ExtendedDescription
    • FamiliarFollowers
    • FeaturedTag
    • Filter
    • FilterKeyword
    • FilterResult
    • FilterStatus
    • IdentityProof
    • Instance
    • List
    • Marker
    • MediaAttachment
    • Notification
    • NotificationPolicy
    • NotificationRequest
    • Poll
    • Preferences
    • PreviewCard
    • PreviewCardAuthor
    • PrivacyPolicy
    • Reaction
    • Relationship
    • RelationshipSeveranceEvent
    • Report
    • Role
    • Rule
    • ScheduledStatus
    • Search
    • Status
    • StatusEdit
    • StatusSource
    • Suggestion
    • Tag
    • TermsOfService
    • Token
    • Translation
    • V1::Filter
    • V1::Instance
    • V1::NotificationPolicy
    • WebPushSubscription

Microformats

一种开放的数据格式,利用 CSS 类来结构化你已有的 HTML。

    • 什么是 microformats?
    • Microformats 类
      • 根元素(h-*)
      • 纯文本属性(p-*)
      • URL 属性(u-*)
      • 日期时间属性(dt-*)
      • 元素树(e-*)
    • 附加类
从 v4.0.0 版本开始,嘟文和账户的 HTML 永久链接已被弃用并从 Mastodon 中移除。因此,Microformats 当前未在 Mastodon 中使用,也未由其生成。

什么是 microformats?

Microformats 2.0 是一种标准,用于将元数据直接嵌入到 HTML 文档中。无需使用 API 进行只读目的,可以通过解析网页中的特定 CSS 类来提取信息。你只需查看页面即可获取这些信息,而不必单独从 API 请求相同的信息。使用 microformats 类可以对给定网页中的数据进行语义解析,并可用于生成 feed、卡片或数据的表示形式。

Microformats 类

所有 microformats 类都使用前缀。前缀表示元素的类型,与层次结构无关。以下是 Mastodon 代码库中使用的 microformats 类。

根元素(h-*)

h-feed

表示一个条目流。附加到账户的嘟文。也附加到详细嘟文视图中的父主题。

h-entry

表示情景性的或带有时间戳的在线内容。附加到嘟文。

h-cite

表示对另一个在线出版物的引用。附加到转嘟。也附加到嘟文详情视图中嘟文串内的其他嘟文。

h-card

表示一个人或组织。附加到昵称、用户名和头像的容器。也附加到提及。

纯文本属性(p-*)

p-author

在 h-entry 或 h-cite 中,表示条目的作者,并附加到昵称、用户名和头像的容器。

p-name

在 h-feed 中,表示 feed 的标题。附加到具有 value 属性的 data 元素。 在 h-entry 或 h-cite 中,表示条目的标题。在 Mastodon 中未使用。 在 h-card 中,表示个人或组织的纯文本名称。附加到昵称。

p-in-reply-to

在嘟文详情的 h-entry 中,表示作为直接上级的嘟文。

p-repost-of

在嘟文详情的 h-entry 中,表示作为转嘟且也是直接上级嘟文的嘟文。目前未使用,因为不能回复转嘟。

p-comment

在嘟文详情的 h-entry 中,表示作为直接下级的嘟文。

URL 属性(u-*)

u-photo

在 h-card 中,表示账户图片。附加到头像图像。

u-uid

在 h-entry 或 h-cite 中,表示通用唯一标识符。附加到时间戳链接。

u-url

在 h-entry 或 h-cite 中,表示嘟文永久链接。附加到时间戳链接。 在 h-card 中,表示账户永久链接。附加到昵称链接。

日期时间属性(dt-*)

dt-published

在 h-entry 或 h-cite 中,表示嘟文发布的日期和时间。附加到具有 value 属性的 data 元素。

元素树(e-*)

e-content

在 h-entry 或 h-cite 中,表示嘟文的内容。附加到嘟文内容。

附加类

这些元素由 Mastodon 附加,用于解析元数据,但从技术上讲不属于 Microformats 术语表的一部分。

mention

表示应在应用内打开该链接,并带有来自 API 的关联提及数据。

hashtag

表示应在应用内打开该链接,并带有来自 API 的关联话题标签数据。

翻译状态: 本文是英文页面 Microformats 的翻译,最后翻译时间:2025-04-21,点击这里可以查看翻译后页面的改动。

最后更新于 April 21, 2025 · 改进此页面
也可在此找到: English

赞助商

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

加入Mastodon · 博客 ·

查看源代码 · CC BY-SA 4.0 · 版权信息