Skip to content

Media items

Media items are the core of your media library. Each media item shows up on the search page and has its own details page. Use media items to describe your sermons, music, videos, and other media content. Each file in the src/content/media folder describes one media item. Every media item references at least one content URL, such as an MP3 file, a YouTube video, or a PDF file.

Here is an example of a media item:

src/content/media/sermon-1--en.json
{
"commonId": "sermon-1",
"title": "The Good Samaritan",
"description": "A sermon about the Good Samaritan",
"type": "video",
"image": "./images/sermon-1-en.jpg",
"categories": ["sermons"],
"language": "en",
"content": [
{
"type": "link",
"url": "https://www.youtube.com/watch?v=1234"
}
]
}

A media item is a JSON file that describes one media item. We recommend filling in as many properties as possible to provide a good user experience. Here is a description of the available properties.

type: string
example: "sermon-1"
required: false

LightNet uses commonId to find translations of a media item. If your media item is available in multiple languages, you should create a media item for each language. In this case use the same commonId for all languages.

type: string
example: "The Good Samaritan"
required: true

The title of the media item. The title should be in the language of the media item.

type: string
example: "en"
required: true

The content language of the media item. The language must be a BCP-47 language code such as en, de, or fr. The language is used to filter media items by language and to display the media item correctly. Provide a matching language entry in astro.config.mjs.

type: string
example: "video"
required: true

This property defines the media type of the media item. It references a file inside the src/content/media-types folder. For example, if you have a file src/content/media-types/book.json, you can set the type property to book. The media type is used to determine the layout of the media item details page.

type: string
example: "./images/sermon-1-en.jpg"
required: true

The path to the image file used as the cover image for the media item. The image should be in the src/content/media/images folder. By convention, image files use this pattern: [commonId]--[language]. If the image contains text, it should be in the media item’s language. Supported image formats include jpg, png, and webp. The image is optimized for performance. We recommend using an image that is at least 1000px wide so it looks good on all devices.

type: { type: "upload" | "link", url: string, label?: object }[]
example: [{type: "link", url: "https://www.youtube.com/watch?v=1234"}]
required: true (at least one content object is required)

This references the actual content of the media item. For example, it can point to a YouTube video or a file served from your server. The content property is an array of objects. The first object in the array is considered to be the primary content of the media item. The primary content is used, for example, by the embedded video player on the media item details page. All other content objects are treated as additional content. They are displayed in the content section of the media item details page.

type: "upload" | "link"
example: "link"
required: true

Use upload for site-managed files such as /files/book.pdf. Use link for external URLs such as YouTube, Vimeo, or other websites.

type: string
example: "/files/sermon-1.mp3"
required: true

Each object has a url property that points to the content. If you want to make a file available for your media item, store it inside the public/files folder and reference it with the url property. For example, if you have a PDF file at public/files/sermon-1.pdf, you can reference it with url: "/files/sermon-1.pdf".

These URL types are supported:

URL typeExample
YouTube video"https://www.youtube.com/watch?v=1234"
Vimeo video"https://vimeo.com/1234"
Internal file"/files/sermon-1.pdf"
External file"https://cdn.example.com/sermon-1.mp3"
External website"https://example.com/sermon-1"

type: object
example: { "en": "Sermon 1" }
required: false

The label property is optional and can be used to give the content a display name. This label appears in the content section of the media item details page. If no label property is provided, the label is derived from the url property. For example, if the url property is "/files/sermon-1.pdf", the label becomes sermon-1. If it is "https://www.youtube.com/watch?v=1234", the content label becomes youtube.com. When provided, use a locale map keyed by your configured site languages.

type: string
example: "2022-01-01"
required: true

The date when the media item was created in this library. The date should be in the format YYYY-MM-DD. This date is used to sort the media items from newest to oldest.

type: string
example: "A sermon about the Good Samaritan"
required: false

A short description of the media item. The description must be in the language of the media item. Use Markdown syntax for formatting the text. The first 350 characters are included on the search page.

type: string[]
example: ["John Doe", "Jane Doe"]
required: false

An array containing the names of the people or organizations that created the media item.

type: string[]
example: ["sermons"]
required: false

An array containing the identifiers of the categories this media item belongs to. The category IDs should match files in the src/content/categories folder. For example, if you have a file src/content/categories/sermons.json, you can set the categories property to ["sermons"].