Fix links for docs (#2908)

* fix docs paths

* docsLink directive

* fix: bugs (#2909)

---------

Co-authored-by: Alex Inkin <alexander@inkin.ru>
This commit is contained in:
Matt Hill
2025-04-24 14:14:08 -06:00
committed by GitHub
parent 2cf4864078
commit 05dd760388
29 changed files with 193 additions and 167 deletions

View File

@@ -0,0 +1,31 @@
import {
computed,
Directive,
inject,
InjectionToken,
input,
} from '@angular/core'
const HOST = 'https://staging.docs.start9.com'
export const VERSION = new InjectionToken<string>('VERSION')
@Directive({
selector: '[docsLink]',
standalone: true,
host: {
target: '_blank',
rel: 'noreferrer',
'[href]': 'url()',
},
})
export class DocsLinkDirective {
private readonly version = inject(VERSION)
readonly href = input.required<string>()
protected readonly url = computed(() => {
const path = this.href()
const relative = path.startsWith('/') ? path : `/${path}`
return `${HOST}${relative}?os=${this.version}`
})
}

View File

@@ -13,6 +13,7 @@ export * from './components/markdown.component'
export * from './components/prompt.component'
export * from './components/server.component'
export * from './directives/docs-link.directive'
export * from './directives/drag-scroller.directive'
export * from './directives/safe-links.directive'

View File

@@ -30,7 +30,7 @@ export function getErrorMessage(e: HttpError | string, link?: string): string {
'Request Error. Your browser blocked the request. This is usually caused by a corrupt browser cache or an overly aggressive ad blocker. Please clear your browser cache and/or adjust your ad blocker and try again'
} else if (!e.message) {
message = 'Unknown Error'
link = 'https://docs.start9.com/latest/support/faq'
link = 'https://docs.start9.com/help/common-issues.html'
} else {
message = e.message
}