Skip to Content
βš™οΈ Site Configuration

Site Configuration

Config Slice State Management

The config slice (src/redux/features/config/slice.ts) centralizes the configuration for the active project and repository.

Primary State Fields

  • userName: The owner of the repository.
  • repo: The repository name.
  • branch: The active branch (e.g., main, master).
  • provider: Either Github or Gitlab.
  • token / installation_token: Stored authentication tokens for the active provider.
  • content.root: The base path for content files (e.g., content, src/content).
  • media.root: The base path for media assets (e.g., public/media).
  • isRawMode: Toggles between the Plate visual editor and the Monaco code editor.

Configuration Actions

updateConfig Partially updates the configuration state. This is called when switching projects or organizations.

dispatch(updateConfig({ repo: "my-repo", provider: "Gitlab", content: { root: "src/content" } }));

resetConfig Resets the state to the initial values. Typically used during logout or when navigating back to the global dashboard.

setRawMode Switches the editor interface mode globally for the active project.

Configuration Discovery

Sitepins automatically detects site configuration by looking for specific files (like .sitepins.json) in the repository root. This configuration is then hydrated into the Redux store to drive the editor UI, media paths, and routing.

Last updated on