fix: Fix community links

This commit is contained in:
Xyphyn committed 2023-07-01 12:50:28 -07:00
1 parent e4d0f985c7
commit b129db8ed5
3 files changed
+40 -4

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
<script lang="ts">
import type { Community } from 'lemmy-js-client'
export let community: Community
function linkFromCommunity(community: Community) {
const local = community.local
if (local) {
return `/c/${community.name}`
} else {
const domain = new URL(community.actor_id).hostname
return `/c/${community.name}@${domain}`
}
}
</script>
<a href={linkFromCommunity(community)}>{community.title}</a>