fix: Fix community links
This commit is contained in:
1 parent
e4d0f985c7
commit
b129db8ed5
3 files changed
+40
-4
No files matched your search
@@ -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>
|
||||
Reference in new issue
Block a user