Publication Content Metadata

Since everything can be considered an NFT in principle, even if it's not collectible, it's important to establish metadata guidelines for all content. These guidelines will define the recommended criteria for content created on the Lens Protocol. This doesn't imply that you're restricted from creating your own criteria, but it does indicate that our API will only include a publication in its index if it adheres to these specified standards.

Metadata Standard

// Refer to the Glossary for the related-enums and interfaces
export interface PublicationContentMetadata {
  name: string
  version: PublicationContentMetadataVersion
  primary_content_type: PublicationContentType
  publication_context?: PublicationContext
  tags?: string[]
  content?: string
  media?: PublicationMedia[]
  app_id?: string
  content_warning?: PublicationContentWarning
}

Glossary

name

Required

Type: string

Name for metadata.

Eg. On Tonfeed, a typical Post by a profile would have the name Post by @capybara_555

version

required

Type: string

export enum PublicationContentMetadataVersion {
  ONE = '1.0.0',
}

primary_content_type

Required

Type: string

export enum PublicationContentType {
  TEXT_ONLY = 'TEXT_ONLY',
  IMAGE = 'IMAGE',
  VIDEO = 'VIDEO',
  ARTICLE = 'ARTICLE',
  AUDIO = 'AUDIO',
  LINK = 'LINK',
  EMBED = 'EMBED',
}

primary_content_type is the main way for the client to identify the main focus of the Publication.

For example, if you are uploading an image and content then it should be tagged as IMAGE as the main publication focus is that. This will allow dApp developers to build unique layouts for every different content type.

Text Only

Text only explains itself, this is a publication with text only. If the person has attached any form of media that should live in image, audio, video, or article. To pass validation on this it needs to have content defined and no media items attached with it.

You have the flexibility to insert multiple media into 1 publication. You just need to provide PublicationMedia data. In the next section you will learn how you can insert multiple media content into 1 publication.

Image

To pass validation it must include an image in the media property which matches one of our supported formats. If it does not it will be rejected. You can of course have other media items in the array alongside the image. Please note we do not check the headers of these items so make sure your web app does not support anything passed these types.

Supported Image Mime Types
  • image/gif

  • image/jpeg

  • image/png

  • image/tiff

  • image/x-ms-bmp

  • image/svg+xml

  • image/webp

Video

To pass validation it must include a video in the media property which matches one of our supported formats. If it does not it will be rejected. You can of course have other media items in the array alongside the video. Please note we do not check the headers of these items so make sure your web app does not support anything passed these types.

Supported Video Mime Types
  • video/webm

  • video/mp4

  • video/x-m4v

  • video/ogv

  • video/quicktime

  • video/mpeg

  • video/ogg

Article

See an article as a way someone can write more than just a small publication. This will allow other UIs knowledge about this as being classed as different from the other publications. The only requirement on this is it must have content defined. No constraints are put on the length that's down to the UIs to decide. Articles can have media all attached as you would a normal article.

Audio

To pass validation it must include an audio file in the media property which matches one of our supported formats. You can of course have other media items in the array alongside the audio file. Please note we do not check the headers of these items so make sure your web app does not support anything passed these types.

Supported Audio Mime Types
  • audio/wav

  • audio/mpeg

  • audio/ogg

  • audio/mp4

  • audio/aac

  • audio/webm

  • audio/flac

This is a way to explain that the main focus is the link itself which may exist within some content. The validation on this is that the content must have a valid https link inside it.

Embed

Pushing the standard even further opensea introduced the metadata standard of animated_url allowing you to embed a webpage into an NFT. This is follows suite and allows you to define that this publication should be embedded. The validation constraint on this is that it must have an animated_url defined. We advise you like opensea do not render these in the timelines, profiles etc and only render it on click on the publication itself. Beware when used badly users could be scammed - make it clear it is an iframe and make sure alerting users and protecting them is your key focus. Also note you can filter these out from your queries if you wish not to support them.

media

Required if content is omitted

type: PublicationMedia[]

export interface PublicationMedia {
  item: string
  mime_type?: string
  alt_tag?: string
  cover?: string
}

publication_context

Optional

export enum PublicationContext {
  ACTIVITY_AND_ACHIEVEMENT = 'ACTIVITY_AND_ACHIEVEMENT',
  STATUS_UPDATE = 'STATUS_UPDATE',
  // more coming soon!
}

This is a way for the client and dApps to identify the context of this publication. ACTIVITY_AND_ACHIEVEMENT can be Posts made by GameFi platforms which highlights the achievement by a player. A regular publication does not require a publication_context.

tags

Optional

Type: string[]

This is a way to insert hashtags to a Publication. Providing hashtags to a publication helps our protocol aggregate popular topics to be featured as Trending Tags.

Constraints:

  • Maximum of 50 characters

  • Alphanumeric characters

  • Emojis

  • Hyphens -

  • Underscores _

  • No whitespaces/line-breaks

content

Required if media is omitted

This is the text content of your publication.

app_id

Optional

Client that published this Publication

content_warning

Optional

type: PublicationContentWarning

export enum PublicationContentWarning {
  NSFW = 'NSFW',
  SENSITIVE = 'SENSITIVE',
  SPOILER = 'SPOILER',
}

Last updated