function getIndexUrl

Get portfolio index URL depending of the presence of /dist/index.html.

Examples

Basic WYSIWYG index

import { getRepoUrl, getIndexUrl } from './url_utils.ts'

const repoUrl = getRepoUrl('john.doe')
const index = getIndexUrl(repoUrl)

console.assert(index.href === new URL('./README.md', repoUrl).href)

Generated index

import { getRepoUrl, getIndexUrl } from './url_utils.ts'

const repoUrl = getRepoUrl('john.doe')
const baseUrl = new URL('./dist/', repoUrl)
const index = getIndexUrl(baseUrl)

console.assert(index.href === new URL('./dist/index.html', repoUrl).href)

Parameters

baseUrl: URL

Repository base url.

Return Type

Index url, ./dist/index.html is available else './README.md'.

Usage

import { getIndexUrl } from "url_utils.ts";