You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
433 B
12 lines
433 B
import { canonicalizeRssArticleUrl } from '@/lib/rss-article' |
|
|
|
/** |
|
* NIP-B0: `d` tag is the URL without the scheme (`https://` / `http://` assumed). |
|
*/ |
|
export function urlToWebBookmarkDTag(url: string): string { |
|
const t = url.trim() |
|
if (!t) return '' |
|
const withScheme = |
|
t.startsWith('http://') || t.startsWith('https://') ? canonicalizeRssArticleUrl(t) : `https://${t}` |
|
return withScheme.replace(/^https?:\/\//i, '') |
|
}
|
|
|