The host on the right says where a link goes when its name does not. Naming a link after its domain is the honest thing to do for a site with no other name, and then the row said the same thing twice. Now only the arrow remains. `www.` is ignored in the comparison, since a link named klot.ski pointing at www.klot.ski is one claim written twice as well.
- commit
- dd3fd256a16ed1e03c909bbc84d944ae812ff1e9
- parent
- 06bd0da6292b57ea10a00e9128d0685f4673403e
- author
- Dami <dami.etoile@gmail.com>
| M | web/ | 17 | ++++++++++++++++- |
@@ -195,6 +195,17 @@ function entry({ kind, name, state, href, onClick }) {
195195 return li;196196 }197197 198+/// Where a link goes, or just an arrow when its name already says so.199+///200+/// `www.` is ignored in the comparison: a link named `klot.ski` pointing at201+/// `www.klot.ski` is the same claim written twice.202+function linkHost(item) {203+ const host = new URL(item.url).host;204+ const same = host.replace(/^www\./, '').toLowerCase()205+ === item.name.replace(/^www\./, '').toLowerCase();206+ return same ? '↗' : `${host} ↗`;207+}208+198209 function group(title, visibility, rows) {199210 const section = document.createElement('section');200211 section.className = 'group';@@ -234,7 +245,11 @@ function renderProfile(profile) {
234245 buckets.public.push(entry({235246 kind: 'link',236247 name: esc(item.name),237- state: `${new URL(item.url).host} ↗`,248+ // The host is there to say where a link goes when its name does not.249+ // When someone names a link after its domain — which is the honest thing250+ // to do for a site that has no other name — repeating it says nothing,251+ // so only the arrow remains.252+ state: linkHost(item),238253 href: item.url,239254 }));240255 } else {