includes/rules_custom.sample.php
<?php
declare(strict_types=1);
/*
|--------------------------------------------------------------------------
| Custom rules
|--------------------------------------------------------------------------
|
| This file is never overwritten by Brivacia updates.
|
| Use it to customize page titles and page URLs displayed in the dashboard.
|
| Available variables:
|
| $isSite1, $isSite2, $isSite3, ...
|
| $title
| $pageKey
| $pageId
| $trackedWebsiteLang
| $url
| $pageUrl
|
| Notes:
|
| - The General section runs for all tracked websites.
| - Site sections only run for the matching website.
| - Simply modify the variables you need.
| - No hooks, callbacks or globals are required.
|
*/
/*
|--------------------------------------------------------------------------
| General
|--------------------------------------------------------------------------
|
| Rules shared by all tracked websites.
|
*/
$title = trim($title);
/*
|--------------------------------------------------------------------------
| Site 1
|--------------------------------------------------------------------------
|
| Example:
| First tracked website from settings.json
|
*/
if ($isSite1) {
// Example: Custom page title
$title = str_replace(
'Old title',
'New title',
$title
);
// Example: Custom page URL
$pageUrl = str_replace(
'/old-page',
'/new-page',
$pageUrl
);
}
/*
|--------------------------------------------------------------------------
| Site 2
|--------------------------------------------------------------------------
|
| Example:
| Second tracked website from settings.json
|
*/
if ($isSite2) {
// Example: append the tracked website language
if ($trackedWebsiteLang === 'en') {
$title .= ' (English)';
}
}
/*
|--------------------------------------------------------------------------
| Additional websites
|--------------------------------------------------------------------------
|
| Add more blocks if needed.
|
*/
if ($isSite3) {
// Site 3 custom rules
}
if ($isSite4) {
// Site 4 custom rules
}