feat: rel=me for profile links, don't show http:// prefix
This commit is contained in:
parent
0c187aaf84
commit
256a14a922
3 changed files with 25 additions and 2 deletions
21
frontend/src/routes/@[username]/ProfileLink.svelte
Normal file
21
frontend/src/routes/@[username]/ProfileLink.svelte
Normal file
|
@ -0,0 +1,21 @@
|
|||
<script lang="ts">
|
||||
import { Icon } from "sveltestrap";
|
||||
|
||||
export let link: string;
|
||||
|
||||
let displayLink: string;
|
||||
$: displayLink = prettifyLink(link);
|
||||
|
||||
const prettifyLink = (raw: string) => {
|
||||
let out = raw;
|
||||
if (raw.startsWith("https://")) out = raw.substring("https://".length);
|
||||
else if (raw.startsWith("http://")) out = raw.substring("http://".length);
|
||||
|
||||
if (raw.endsWith("/")) out = raw.substring(0, raw.length - 1);
|
||||
|
||||
return out;
|
||||
};
|
||||
</script>
|
||||
|
||||
<Icon name="globe" />
|
||||
<a href={link} rel="me nofollow noreferrer" target="_blank">{displayLink}</a>
|
Loading…
Add table
Add a link
Reference in a new issue