The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
added changelog post, fixed middleware redirect
Steven Tey4c20e95660e2
diff --git a/lib/middleware/link.ts b/lib/middleware/link.tsindex c8e1ec00de..0278df9c03 100644--- a/lib/middleware/link.ts+++ b/lib/middleware/link.ts@@ -14,7 +14,7 @@ export default async function LinkMiddleware(ev: NextFetchEvent,) {const url = req.nextUrl.clone();- const { domain, key } = parse(req);+ const { domain, fullKey: key } = parse(req);if (!domain || !key) {return NextResponse.next();diff --git a/lib/middleware/utils.ts b/lib/middleware/utils.tsindex 502c51faa1..905ca0e1b0 100644--- a/lib/middleware/utils.ts+++ b/lib/middleware/utils.ts@@ -6,12 +6,10 @@ export const parse = (req: NextRequest) => {domain = domain.replace("www.", ""); // remove www. from domainif (HOME_HOSTNAMES.has(domain)) domain = "dub.sh";const path = req.nextUrl.pathname;+ const key = decodeURIComponent(path.split("/")[1]); // decodeURIComponentto handle foreign languages like Hebrew+ const fullKey = decodeURIComponent(path).slice(1);- // decodeURIComponent to handle foreign languages like Hebrew- // slice(1) to remove the leading slash- const key = decodeURIComponent(path).slice(1);-- return { domain, path, key };+ return { domain, path, key, fullKey };};export const detectBot = (req: NextRequest) => {diff --git a/posts/changelog/improved-link-management.mdx b/posts/changelog/improved-link-management.mdxnew file mode 100644index 0000000000..8d4c7efa49--- /dev/null+++ b/posts/changelog/improved-link-management.mdx@@ -0,0 +1,15 @@+---+title: Improved Link Management+publishedAt: 2023-05-14+summary: "Introducing a range of improvements to our link management offering: Archiving links, show my links only, allow '/' in custom shortlinks."+image: "https://d2vwwcvoksz7ty.cloudfront.net/changelog/improved-link-management.png"+author: "steventey"+---++Today, we are introducing a range of improvements to our link management offering:++1. **Archiving links**: You can now archive your links with the click of a button. Archived links will still work & accrue stats, but will be hidden on your dashboard by default.++2. **Show my links only**: You can now filter your project links with the "Show my links only" filter, which will hide all links created by other users in your organization.++3. **Allow '/' in custom shortlinks**: You can now use '/' in your custom shortlinks. This is useful for creating shortlinks that mimic your website's URL structure. Huge shoutout to [Alex Bass](https://twitter.com/alexhbass) from [Efficient](https://efficient.app/) for this feature request!