diff --git a/providers/app_provider.ts b/providers/app_provider.ts index 5687a00..59a8e44 100644 --- a/providers/app_provider.ts +++ b/providers/app_provider.ts @@ -1,3 +1,4 @@ +import edge from 'edge.js' import { join } from 'node:path' import { readFile } from 'node:fs/promises' import { getDirname } from '@poppinss/utils' @@ -25,5 +26,10 @@ export default class AppProvider { this.app.container.bind(PackagesFetcher, async (resolver) => { return new PackagesFetcher(await resolver.make(PackageFetcher), packagesFile) }) + + /** + * Helper for removing double slashes from urls + */ + edge.global('cleanUrl', (url: string) => url.replace(/([^:]\/)\/+/g, '$1')) } } diff --git a/resources/views/components/meta.edge b/resources/views/components/meta.edge index 1c231ae..a480d3c 100644 --- a/resources/views/components/meta.edge +++ b/resources/views/components/meta.edge @@ -1,6 +1,6 @@ @assign(title = title ?? 'AdonisJS Packages') @assign(description = description ?? 'Discover our list of packages to supercharge your AdonisJS project. Created by the AdonisJS team and community.') -@assign(image = image ?? 'https://packages.adonisjs.com/preview.png') +@assign(image = image ?? '/preview.png') {{ `${title} - AdonisJS Packages` }} @@ -11,7 +11,7 @@ - + {{-- Twitter --}} @@ -19,4 +19,4 @@ - \ No newline at end of file + \ No newline at end of file