fromPath static method

void fromPath(
  1. String path
)

Build and set canonical URL from base URL + path

Uses the baseUrl from WebifyConfig

Implementation

static void fromPath(String path) {
  if (!Webify.isInitialized) return;
  final baseUrl = Webify.instance.config.baseUrl;
  if (baseUrl == null) return;

  final cleanBase = baseUrl.endsWith('/')
      ? baseUrl.substring(0, baseUrl.length - 1)
      : baseUrl;
  final cleanPath = path.startsWith('/') ? path : '/$path';

  set('$cleanBase$cleanPath');
}