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}`
})
}