Configuration reference
You configure the LightNet Astro integration in the astro.config.mjs file.
import lightnet from "lightnet";import { defineConfig } from "astro/config";
export default defineConfig({ site: "https://yourdomain.com", integrations: [ lightnet({ /* Your config here */ }), ],});These are the available options:
type: object
example: { en: "My Library" }
required: true
The title of your site. For example, it is shown in the header bar. Provide a locale map keyed by your configured site languages. The default site language is required.
languages
Section titled “languages”type: array
example: [{ code: "en", label: { en: "English" }, isDefaultSiteLanguage: true }]
required: true
The languages known to your site. Use this list to define language codes, display labels, site locales, and translation fallback behavior.
languages: code
Section titled “languages: code”type: string
example: "en"
required: true
The IETF BCP-47 code of the language. This code is used as the language’s identifier.
languages: label
Section titled “languages: label”type: object
example: { en: "English", de: "Englisch" }
required: true
The display name of the language used in the UI, for example in language selectors. Provide a locale map keyed by your configured site languages. The default site language is required.
languages: isDefaultSiteLanguage
Section titled “languages: isDefaultSiteLanguage”type: boolean
example: true
required: false
If you set this to true, the language is used as the default site language.
You must set exactly one language to be the default language. The default site language is used:
- As the fallback language if a translation is not available for the current locale.
- As the default language when the user navigates to the root URL path (
/).
languages: isSiteLanguage
Section titled “languages: isSiteLanguage”type: boolean
example: true
required: false
Configure this language to be available as a site language.
It shows up in the language picker in the menu bar.
You do not need to set this if isDefaultSiteLanguage is true.
languages: fallbackLanguages
Section titled “languages: fallbackLanguages”type: string[]
example: ["en"]
required: false
An array of fallback language codes used when translations are not available for the current locale. LightNet iterates over this array in order and uses the first language that provides a matching translation key. If no match is found, LightNet falls back to the default site language and finally to English.
type: object
example: { src: "./src/assets/logo.png" }
required: false
The logo of your site, shown in the header bar next to the site title.
logo: src
Section titled “logo: src”type: string
example: "./src/assets/logo.png"
required: true
The path to the logo image. Provide a path to an image inside src/assets. Supported formats include jpg, png, svg and webp.
LightNet optimizes the image size for better performance, except for SVGs. We recommend providing an image file with a width and height of 150 pixels.
logo: alt
Section titled “logo: alt”type: object
example: { en: "My Library logo" }
required: false
The alt text of the logo. This is used if the logo image is not available or if the user has disabled images, for example while using a screen reader. Provide a locale map keyed by your configured site languages.
logo: size
Section titled “logo: size”type: number
example: 30
required: false
default: 28
The size of the logo in the header bar in pixels. This is applied to the shorter side of the logo image.
logo: replacesTitle
Section titled “logo: replacesTitle”type: number
example: 30
required: false
default: false
If set to true, no title will show next to the logo on the header bar. Additionally, to support screen readers, the site title
is set to the logo’s alt attribute. Use this option if your logo already includes your site title.
favicon
Section titled “favicon”type: array
example: [{ rel: "icon", href: "favicon.ico" }]
required: false
The favicon of your site. A favicon is a small icon displayed in the browser tab and bookmarks.
LightNet’s API supports multiple favicon formats. Each entry in the favicon array maps to an HTML <link> element. For example:
Input:
lightnet({ favicon: [ { rel: "icon", href: "favicon.ico", sizes: "32x32", }, ],});Maps to the following HTML:
<head> <link rel="icon" type="image/x-icon" href="favicon.ico" sizes="32x32" /></head>favicon: href
Section titled “favicon: href”type: string
example: "/favicon.svg"
required: true
The path to the favicon. This must point to an image inside the public/ directory.
favicon: rel
Section titled “favicon: rel”type: "icon" | "apple-touch-icon"
example: "icon"
required: false
default: "icon"
This sets the rel attribute of the favicon.
Refer to the MDN documentation for more information.
favicon: sizes
Section titled “favicon: sizes”type: string
example: "32x32"
required: false
This sets the sizes attribute of the favicon.
Refer to the MDN documentation for more information.
manifest
Section titled “manifest”type: string
example: "/manifest.json"
required: false
This sets the manifest of the site. The file must be inside the public/ directory.
mainMenu
Section titled “mainMenu”type: array
example: [{ href: "/about", label: { en: "About" } }]
required: false
This sets the main menu of the site. It is expected to be an array with at least one entry. Each entry is an object with the following properties:
mainMenu: href
Section titled “mainMenu: href”type: string
example: "/about"
required: true
The link target of the main menu entry. The value can be an internal or an external link. Internal links are automatically prefixed with the current locale.
mainMenu: label
Section titled “mainMenu: label”type: object
example: { en: "About" }
required: true
The label of the main menu entry. Provide a locale map keyed by your configured site languages.
mainMenu: requiresLocale
Section titled “mainMenu: requiresLocale”type: boolean
example: false
required: false
default: true
Internal links are by default prefixed with the current locale (e.g., /media becomes /en/media for English).
To disable this, set requiresLocale property to false.
You do not need to set this option for external links such as https://wikipedia.org, since they will not be prefixed anyway.
internalDomains
Section titled “internalDomains”type: array
example: [ "files.your-domain.com" ]
required: false
The internal domains of the site. This is used to determine whether a URL is internal or external.
For example if you want to link to your files on a different domain e.g. on a subdomain files.your-domain.com, you can add it to the internalDomains array.
A link to https://files.your-domain.com/file.pdf won’t be treated as an external link.
headComponent
Section titled “headComponent”type: string
example: "./src/components/MyHeadTag.astro"
required: false
Path to an Astro component to be added to the HTML head element of all pages.
For example this component would add a script to every page:
------<script src="my-js-file.js" defer></script>footerComponent
Section titled “footerComponent”type: string
example: "./src/components/MyFooter.astro"
required: false
Path to an Astro component to be added at the bottom of all pages. Here is a guide on how to use the footer.
searchPage
Section titled “searchPage”type: object
example: { filterByLocale: true }
required: false
Search page related settings.
searchPage: filterByLocale
Section titled “searchPage: filterByLocale”type: boolean
example: true
required: false
default: false
If you set this to true, the search results are initially filtered by the current site language.
The filter is applied when at least one media item is associated with that language. Users are still able to change
the language filter’s value. By default the language filter is initially set to “All languages”.
searchPage: hideHeaderSearchIcon
Section titled “searchPage: hideHeaderSearchIcon”type: boolean
example: true
required: false
default: false
Set to true, this will remove the search magnifier icon from the header bar. This setting won’t remove
the search page on /media.
credits
Section titled “credits”type: boolean
example: true
required: false
default: false
If set to true, a “Powered by LightNet” message will appear in the footer.
You can toggle this as you prefer, though we’d appreciate it if you keep it enabled — it helps others discover LightNet.