Get portfolio source URL from request URL.
▶Basic WYSIWYG index
Basic WYSIWYG index
import { getRepoUrl, getSourceUrl } from './url_utils.ts' const repoUrl = getRepoUrl('john.doe') const index = getSourceUrl('/', repoUrl) const file = getSourceUrl('/dir/path/file.any', repoUrl) console.assert(index.href === new URL('./README.md', repoUrl).href) console.assert(file.href === new URL('./dir/path/file.any', repoUrl).href)
▶Generated index
Generated index
import { getRepoUrl, getSourceUrl } from './url_utils.ts' const repoUrl = getRepoUrl('john.doe') const baseUrl = new URL('./dist/', repoUrl) const index = getSourceUrl('/', baseUrl) const file = getSourceUrl('/dir/path/file.any', baseUrl) console.assert(index.href === new URL('./dist/index.html', repoUrl).href) console.assert(file.href === new URL('./dist/dir/path/file.any', repoUrl).href)