Skip to content

$site / useSite()

Provides reactive access to the active OctoberCMS site.

Use $site inside Vue templates or useSite() inside Composition API code.

Basic Usage

vue
<template>
    <section :lang="$site.locale">
        <p>{{ $site.name }}</p>
    </section>
</template>

<script lang="ts" setup>
import { useSite } from '@ratmd/laika';

const site = useSite();
console.log(site.value?.code);
</script>

Site Properties

The ref returned by useSite() updates when the active LAIKA payload changes.

PropertyTypeDescription
namestringDisplay name of the active site.
codestringUnique site code.
urlstringConfigured site URL.
prefixstringURL prefix used by the site.
themestringTheme assigned to the site.
localestringActive site locale.
timezonestringTimezone configured for the site.

This software is not an official OctoberCMS product and is not associated with, sponsored by, or endorsed by OctoberCMS.