Skip to content

Links and Routes

Mehrdad Pajuhaan edited this page Oct 23, 2026 · 1 revision

Links and Routes

A community lives at public URLs that members share, and inside your app it needs routes that match the Selldone Storefront. This page covers the CommunityURLs helper for building share and embed links, and the community route names exposed as window.$community.routes.

CommunityURLs

CommunityURLs is a static helper class shipped in the package. Import it by path:

import { CommunityURLs } from "@selldone/sdk-community/url/CommunityURLs";
Method Returns
CommunityUrl(shop) <shop URL>/community
CommunityInviteLink(shop) <shop URL>/community
PostUrl(shop, post) <shop URL>/POSTS/{post.id}
CommentUrl(shop, comment) <shop URL>/COMMENTS/{comment.id}
PostEmbedUrl(shop, post) <selldone-iframe URL>/POSTS/{post.id}/embed
TopicShortUrl(community_id, topic_id) <service-url>/CROSS/{community_id}/{topic_id} (short link)

How the base URL is chosen:

  • <shop URL> comes from ShopURLs.MainShopUrl(shop) in Selldone Core: the shop's primary custom domain if it has one, otherwise its subdomain or <service-url>/@{shop name}.
  • When shop is null, the methods fall back to the service-url meta value (the main Selldone community). PostEmbedUrl uses the selldone-iframe meta value for shop posts.
const shareUrl = CommunityURLs.PostUrl(shop, post);
await navigator.clipboard.writeText(shareUrl);

const embedUrl = CommunityURLs.PostEmbedUrl(shop, post);
const iframe = `<iframe src="${embedUrl}" width="100%" height="480" frameborder="0"></iframe>`;

Route names

window.$community.routes is the CommunityRoutesName enum from Selldone Core:

Key Route name Storefront path
COMMUNITY_HOME_PAGE CommunityHomePage /community
COMMUNITY_CATEGORY_PAGE CommunityCategoryPage /community/:category_id-:category_slug?
COMMUNITY_TOPIC_PAGE CommunityTopicPage /community/:category_id-:category_slug?/:topic_id-:topic_slug?

The official Storefront also defines /community/feed (CommunityFeedPage) and /community/comments (CommunityMyCommentsPage), and renders all of these pages with the community components from Components.

Use the route names to navigate to community pages with Vue Router:

router.push({
  name: window.$community.routes.COMMUNITY_TOPIC_PAGE,
  params: {
    category_id: category.id,
    category_slug: categorySlug,
    topic_id: topic.id,
    topic_slug: topicSlug,
  },
});

If you build your own router, keep the same names and parameters so the Components community UI can navigate between pages.

Related

Clone this wiki locally