function getBaseUrl

Determine portfolio base URL from the repository structure. Check the presence of ./dist/index.html to return either ./dist/ either ./ as base path.

Examples

Basic WYSIWYG index

Portfolio structure

/
├──  README.md
└── *

Resolved pathname

import { getBaseUrl } from './url_utils.ts'

const baseUrl = await getBaseUrl('john.doe')

console.assert(baseUrl.pathname === '/')

Generated index

Portfolio structure

/
├──  dist
│  ├──  index.html
│  └── *
└── *

Resolved pathname

import { getBaseUrl } from './url_utils.ts'

const baseUrl = await getBaseUrl('john.doe')

console.assert(baseUrl.pathname === '/dist/')

Parameters

user: User

User login of owner of the portfolio.

Return Type

Promise<URL>

Portfolio base URL.

Usage

import { getBaseUrl } from "url_utils.ts";