* feat: add default search engines seeding * feat: set Homarr Docs as the default search Set the default search engine in server settings during seeding * refactor: use typed methods to define settings * feat: add insertServerSettingByKeyAsync * feat: update seeding logic for server settings * fix: format file using prettier * fix: disable eslint for `urlTemplate` * refactor: remove never happning else * feat: enhance createDocumentationLink - Updated createDocumentationLink to accept query parameters * test: add unit tests for createDocumentationLink * fix: update urlTemplate for Homarr documentation
15 lines
494 B
TypeScript
15 lines
494 B
TypeScript
import type { HomarrDocumentationPath } from "./homarr-docs-sitemap";
|
|
|
|
const documentationBaseUrl = "https://homarr.dev";
|
|
|
|
// Please use the method so the path can be checked!
|
|
export const createDocumentationLink = (
|
|
path: HomarrDocumentationPath,
|
|
hashTag?: `#${string}`,
|
|
queryParams?: Record<string, string>,
|
|
) => {
|
|
const url = `${documentationBaseUrl}${path}`;
|
|
const params = queryParams ? `?${new URLSearchParams(queryParams)}` : "";
|
|
return `${url}${params}${hashTag ?? ""}`;
|
|
};
|