Skip to content

Conversation

csemazharul
Copy link
Contributor

@csemazharul csemazharul commented Mar 3, 2025

This update adds a siteBaseURL variable to manage both single-site and multisite environments. It ensures that all plugins retrieve the correct site URL dynamically, improving consistency across the backend and frontend.

Changes & Implementation:

Added jsConfig variable in backend config file.

'siteBaseURL' => is_multisite() ? network_site_url() : site_url(),

Updated global.d.ts to Include SERVER_VARIABLES Type

declare const SERVER_VARIABLES {
    ....
    siteBaseURL: string;
    ....
}

Updated config.ts to Include SITE_BASE_URL

Added type definition:

interface ConfigType {
  ...
  SITE_BASE_URL: string;
  ...
}

Fetches the value from server variables:

SITE_BASE_URL: getServerVariable('siteBaseURL'),

Note: The file names (config.php, global.d.ts, config.ts, etc.) depend on the specific application structure and use case.

@Arif-un Arif-un merged commit 56077b5 into main Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants