{"_id":"@plugdash/shortlink","_rev":"6-5ac4e6bb02de950ddf9190349a1b5da0","name":"@plugdash/shortlink","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@plugdash/shortlink","version":"0.1.0","keywords":["emdash","emdash-plugin","shortlink","pretty-links"],"license":"MIT","_id":"@plugdash/shortlink@0.1.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"dist":{"shasum":"1ef466f4bdbb78d73b8e4bae551b7bba90e8f5b9","tarball":"https://registry.npmjs.org/@plugdash/shortlink/-/shortlink-0.1.0.tgz","fileCount":12,"integrity":"sha512-JNC/Heu9IVA6bBuBKQtoJl7mctpjnLFkgS6Y+SPzxso1CvbiF7VZawHOj6Ov6KElRCJfbKoifOma4AqNVEA3Rg==","signatures":[{"sig":"MEUCIQDf+7BYxglV6jQS8+vA1e5I+atbfWcijjtwI73WHcI0ugIgUvDoUWQEXtQ+zn22T7u+HYoMaREsQf0Mgn9POnDEnWc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51424},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-shortlink-0.1.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./CopyLink.astro":"./src/CopyLink.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts --dts.eager","typecheck":"tsc --noEmit"},"_npmUser":{"name":"abhinav061","email":"abhinav061@gmail.com"},"_resolved":"/private/var/folders/6y/57bqcl410dl_xsbfbpkrgv500000gn/T/e722a285ebc6be2079fa833fa460b40b/plugdash-shortlink-0.1.0.tgz","_integrity":"sha512-JNC/Heu9IVA6bBuBKQtoJl7mctpjnLFkgS6Y+SPzxso1CvbiF7VZawHOj6Ov6KElRCJfbKoifOma4AqNVEA3Rg==","_npmVersion":"11.11.0","description":"Short URLs for EmDash posts - shareable links created on publish","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":"^0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/shortlink_0.1.0_1775374819918_0.006516761849696184","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@plugdash/shortlink","version":"0.2.0","keywords":["emdash","emdash-plugin","shortlink","pretty-links"],"license":"MIT","_id":"@plugdash/shortlink@0.2.0","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"434b141c6ff24f660c914ca585a3312d70505056","tarball":"https://registry.npmjs.org/@plugdash/shortlink/-/shortlink-0.2.0.tgz","fileCount":17,"integrity":"sha512-f+DUGr2zYKjT/7Ikk0PTtoB/A4wEL3KdvDihHFN+ke8Hi8PxCzO5EOh0FWZo7jMhGOwqMkHpaEoLFjNIqnTlOg==","signatures":[{"sig":"MEYCIQCDMpe76siduJqY39tABp7p5ryKQyRskO5Pd7+og5pmEgIhAIRAGiDYdAqzaLboOeyVfpGjX9s2nKPxLyEls8gPDUdt","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fshortlink@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60195},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-shortlink-0.2.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./CopyLink.astro":"./src/CopyLink.astro","./redirect-logic":{"types":"./dist/redirect-logic.d.mts","import":"./dist/redirect-logic.mjs"},"./RedirectPage.astro":"./src/RedirectPage.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts src/redirect-logic.ts --dts.eager","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d672fd2b-5abd-4a64-923d-69e1689a2e4c"}},"_resolved":"/tmp/26aa77a0db30ac1302395175509e5e2f/plugdash-shortlink-0.2.0.tgz","_integrity":"sha512-f+DUGr2zYKjT/7Ikk0PTtoB/A4wEL3KdvDihHFN+ke8Hi8PxCzO5EOh0FWZo7jMhGOwqMkHpaEoLFjNIqnTlOg==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/shortlink"},"_npmVersion":"11.5.1","description":"Short URLs for EmDash posts - shareable links created on publish","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":"^0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/shortlink_0.2.0_1775416193476_0.30728958566284925","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@plugdash/shortlink","version":"0.2.2","keywords":["emdash","emdash-plugin","shortlink","pretty-links"],"license":"MIT","_id":"@plugdash/shortlink@0.2.2","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"e0994cddb13f06b5859fa36ed427d2c6aec1677b","tarball":"https://registry.npmjs.org/@plugdash/shortlink/-/shortlink-0.2.2.tgz","fileCount":17,"integrity":"sha512-6KUxeeryd/HFDBdo1f9jUWxOYevQJWtl7JMQ0QenRlNlQfKmMjGVpicCYiO01DKPKBRlPISF+Brg3dsT1XzU7g==","signatures":[{"sig":"MEUCIQDwBmzcXltQnfVXox+MPcTAtwp3YXTsZJBngqfJzuoePwIgNjEz/RlBSlZXmDWg76EObj4llg0TUMrYPjI+wKZCobk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fshortlink@0.2.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":60562},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-shortlink-0.2.2.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./CopyLink.astro":"./src/CopyLink.astro","./redirect-logic":{"types":"./dist/redirect-logic.d.mts","import":"./dist/redirect-logic.mjs"},"./RedirectPage.astro":"./src/RedirectPage.astro"},"scripts":{"test":"vitest run","build":"tsdown src/index.ts src/sandbox-entry.ts src/redirect-logic.ts --dts.eager","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d672fd2b-5abd-4a64-923d-69e1689a2e4c"}},"_resolved":"/tmp/368173e37fc383cfdeca4491cad7a438/plugdash-shortlink-0.2.2.tgz","_integrity":"sha512-6KUxeeryd/HFDBdo1f9jUWxOYevQJWtl7JMQ0QenRlNlQfKmMjGVpicCYiO01DKPKBRlPISF+Brg3dsT1XzU7g==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/shortlink"},"_npmVersion":"11.5.1","description":"Short URLs for EmDash posts - shareable links created on publish","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":"^0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/shortlink_0.2.2_1775586100424_0.9188704816200333","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@plugdash/shortlink","version":"0.2.3","keywords":["emdash","emdash-plugin","shortlink","pretty-links"],"license":"MIT","_id":"@plugdash/shortlink@0.2.3","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"4e9b879a177e6310fee4119e4dd22955456c743e","tarball":"https://registry.npmjs.org/@plugdash/shortlink/-/shortlink-0.2.3.tgz","fileCount":17,"integrity":"sha512-7p4HcNi+OpyK7I+1R5Y5qTnUA0tEQoE+XWL++ABMM7xC7R4+kNOIz47ygp0EDO8NiVTmRc092ZVkW8+HPbwl0w==","signatures":[{"sig":"MEYCIQDHG5KsmtHuacWczaAHh8XGqpTjipYoStuquTQv3ar0zQIhAMWyZlCA3w0/tC1c0t+WEi1E6m+3u+j91nyJ4aAv90/1","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIC3gopABfNzqgESo7BAeXI1lYq59ssD9NWBEMkGc/gG4AiBwZXpE2AB3tAssZfR3YlxLsoR6XSPxDTzYqU4SKHYwEQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fshortlink@0.2.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":79166},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-shortlink-0.2.3.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./CopyLink.astro":"./src/CopyLink.astro","./redirect-logic":{"types":"./dist/redirect-logic.d.mts","import":"./dist/redirect-logic.mjs"},"./RedirectPage.astro":"./src/RedirectPage.astro"},"scripts":{"lint":"oxlint --ignore-pattern '*.astro' .","test":"vitest run","build":"tsdown src/index.ts --dts.eager && tsdown src/sandbox-entry.ts --dts.eager --no-clean && tsdown src/redirect-logic.ts --dts.eager --no-clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d672fd2b-5abd-4a64-923d-69e1689a2e4c"}},"_resolved":"/tmp/d9a0d5cedcc0064a8bfdb89fa86ec949/plugdash-shortlink-0.2.3.tgz","_integrity":"sha512-7p4HcNi+OpyK7I+1R5Y5qTnUA0tEQoE+XWL++ABMM7xC7R4+kNOIz47ygp0EDO8NiVTmRc092ZVkW8+HPbwl0w==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/shortlink"},"_npmVersion":"11.5.1","description":"Short URLs for EmDash posts - shareable links created on publish","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/shortlink_0.2.3_1790352146390_0.8884514032420536","host":"s3://npm-registry-packages-npm-production"}},"0.2.4":{"name":"@plugdash/shortlink","version":"0.2.4","keywords":["emdash","emdash-plugin","shortlink","pretty-links"],"license":"MIT","_id":"@plugdash/shortlink@0.2.4","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"homepage":"https://github.com/plugdash/plugdash#readme","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"55987d49c4fb30a2f88e622bdd631ae535aba505","tarball":"https://registry.npmjs.org/@plugdash/shortlink/-/shortlink-0.2.4.tgz","fileCount":17,"integrity":"sha512-waWsFNTF9YviyOEotrJid8dmwMKX3dTqlwF825kmkHcjYccqjO6ByhurHlnkrfTSDDNlPPah6pNJ5j76xPgoPg==","signatures":[{"sig":"MEQCIFbWcVBi9Muq7RzTpuvD/rdiCGQeeALBXZvhvmHWcOT/AiAeogLR+txNWEMNR8MwblwykBuksDK57obE7/po5KT0rQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCICgezkDVT36UzFQ4YAUYf4i8pAUg4mYtMbzzNu5YFhHkAiAlWSWeBp8oUNesTEoVGTJbnKcCPa81YtvRArHycM+ELA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fshortlink@0.2.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":79313},"main":"./dist/index.mjs","type":"module","_from":"file:plugdash-shortlink-0.2.4.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":{"import":"./dist/sandbox-entry.mjs"},"./CopyLink.astro":"./src/CopyLink.astro","./redirect-logic":{"types":"./dist/redirect-logic.d.mts","import":"./dist/redirect-logic.mjs"},"./RedirectPage.astro":"./src/RedirectPage.astro"},"scripts":{"lint":"oxlint --ignore-pattern '*.astro' .","test":"vitest run","build":"tsdown src/index.ts --dts.eager && tsdown src/sandbox-entry.ts --dts.eager --no-clean && tsdown src/redirect-logic.ts --dts.eager --no-clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d672fd2b-5abd-4a64-923d-69e1689a2e4c"}},"_resolved":"/tmp/e3a3030bbadadbab0ba9ee808fabd65b/plugdash-shortlink-0.2.4.tgz","_integrity":"sha512-waWsFNTF9YviyOEotrJid8dmwMKX3dTqlwF825kmkHcjYccqjO6ByhurHlnkrfTSDDNlPPah6pNJ5j76xPgoPg==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/shortlink"},"_npmVersion":"11.5.1","description":"Short URLs for EmDash posts - shareable links created on publish","directories":{},"_nodeVersion":"22.23.2","_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.0.0","@plugdash/types":"0.0.0","@plugdash/testing":"0.0.0"},"peerDependencies":{"emdash":">=0.13.0"},"_npmOperationalInternal":{"tmp":"tmp/shortlink_0.2.4_1790409380256_0.9421613924893053","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@plugdash/shortlink@0.3.0","bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"dist":{"shasum":"254bdd6c79ff1791e716e4312add5e4fe02d2aef","tarball":"https://registry.npmjs.org/@plugdash/shortlink/-/shortlink-0.3.0.tgz","fileCount":9,"integrity":"sha512-sLcPfJqjsTV69oiMHL5/qwvUlpnuxabhn/ms4q0jDX9PPpWvFLNYTCDHYhzc+ne78x1X2fsG1HMcdbrhl9nirw==","signatures":[{"sig":"MEQCIEvbYSGnLsAxf+EAtWw6eIA9tKl3nDi9ESD7WX6yk1FdAiB+0YXsKhNJfeaDO1kqGLLFt6IUXJnUmTutdzJOSDiKrA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFTAxNqD4s/SvoMGkN799bCaBVqe+chq2uJUSwkNgPaEAiATos4CthOGMu3ovb9bTQcU0uDDclGz/mJts8KuUXvQQA=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@plugdash%2fshortlink@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":31891},"main":"./dist/index.mjs","name":"@plugdash/shortlink","type":"module","_from":"file:plugdash-shortlink-0.3.0.tgz","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./CopyLink.astro":"./src/CopyLink.astro"},"license":"MIT","scripts":{"lint":"oxlint --ignore-pattern '*.astro' .","test":"vitest run","build":"tsdown src/index.ts --dts.eager","typecheck":"tsc --noEmit"},"version":"0.3.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"d672fd2b-5abd-4a64-923d-69e1689a2e4c"}},"homepage":"https://github.com/plugdash/plugdash#readme","keywords":["emdash","emdash-plugin","pretty-links","shortlink"],"_resolved":"/tmp/edb52b170184fe9fe7cdfd892490f990/plugdash-shortlink-0.3.0.tgz","_integrity":"sha512-sLcPfJqjsTV69oiMHL5/qwvUlpnuxabhn/ms4q0jDX9PPpWvFLNYTCDHYhzc+ne78x1X2fsG1HMcdbrhl9nirw==","repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/shortlink"},"_npmVersion":"11.5.1","description":"Short URLs for EmDash posts - one native EmDash redirect per published entry","directories":{},"maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"_nodeVersion":"22.23.3","_hasShrinkwrap":false,"devDependencies":{"emdash":"^1.0.1","vitest":"^2.0.0"},"peerDependencies":{"emdash":">=1.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/shortlink_0.3.0_1790936842684_0.9726327398012455"}}},"time":{"created":"2026-04-05T07:40:19.829Z","modified":"2026-10-02T10:27:23.142Z","0.1.0":"2026-04-05T07:40:20.063Z","0.2.0":"2026-04-05T19:09:53.645Z","0.2.2":"2026-04-07T18:21:40.610Z","0.2.3":"2026-09-25T16:02:26.486Z","0.2.4":"2026-09-26T07:56:20.340Z","0.3.0":"2026-10-02T10:27:22.765Z"},"bugs":{"url":"https://github.com/plugdash/plugdash/issues"},"license":"MIT","homepage":"https://github.com/plugdash/plugdash#readme","keywords":["emdash","emdash-plugin","pretty-links","shortlink"],"repository":{"url":"git+https://github.com/plugdash/plugdash.git","type":"git","directory":"packages/shortlink"},"description":"Short URLs for EmDash posts - one native EmDash redirect per published entry","maintainers":[{"name":"abhinav061","email":"abhinav061@gmail.com"}],"readme":"# @plugdash/shortlink\n\nEvery post deserves a short URL, and most setups hand that to an outside service.\nOn publish, this plugin adds one native EmDash redirect per entry (`/s/<code>` to the post, 301). There's no custom route, no page to add, and no metadata to read.\nShips `CopyLink.astro`, a copy-to-clipboard button that builds the short URL from the entry id.\nThe EmDash equivalent of [Pretty Links](https://wordpress.org/plugins/pretty-link/) (basic tier).\n\n## Install\n\n```bash\npnpm add @plugdash/shortlink\n```\n\n## Register\n\n```js\n// astro.config.mjs\nimport { defineConfig } from \"astro/config\";\nimport emdash from \"emdash/astro\";\nimport { shortlinkPlugin } from \"@plugdash/shortlink\";\n\nexport default defineConfig({\n\tintegrations: [\n\t\temdash({\n\t\t\tplugins: [shortlinkPlugin()],\n\t\t}),\n\t],\n});\n```\n\nThat's it. Publish a post and `/s/<code>` answers with a 301 in one request, in dev and in production.\n\n## How it works\n\n- The code is the last 8 characters of the entry id, lowercased: `01J9ZQ3V8R5K7M2N4P6Q8S0T1W` gives `6q8s0t1w`. You can get it from `shortCode(id)`, which the package root exports.\n- On `content:afterPublish` the plugin checks whether the redirect already exists. If not, it creates `{ source: \"/s/<code>\", destination, type: 301, groupName: \"shortlink\" }`.\n- The destination is the entry's public path, based on the collection's URL pattern. If the collection has no URL pattern, the `pathPattern` option is used instead. Only the path is stored, never the site origin, so a stale site URL can't leak into links.\n- Republishing does nothing when the destination hasn't changed. If it has changed, for example because the URL pattern changed, the plugin updates the redirect.\n- When a slug changes, EmDash adds its own \"slug change\" redirect and rewrites any redirect that pointed at the old URL. The short link moves to the new URL in one hop, with no help from the plugin.\n- Collisions: if `/s/<code>` already exists and belongs to a different entry or was added by hand, the plugin leaves it alone. It logs both entry ids at error level.\n- Hits, the last-hit time and 404 tracking all come from EmDash's redirect engine.\n\n## Managing short links\n\nOpen **Redirects** in the EmDash admin and filter by group `shortlink`. From there you can see hits, edit destinations, or turn a short link off.\n\nTo stop a short link working, **disable** it instead of deleting it. A deleted short link comes back the next time its entry is published.\n\n## Companion component\n\n```astro\n---\nimport CopyLink from \"@plugdash/shortlink/CopyLink.astro\";\n---\n\n<CopyLink post={post} />\n```\n\n`post` is the entry from `getEmDashEntry` / `getEmDashCollection`. The component reads `post.data.id` and makes no database call. The absolute URL uses `Astro.site` when it's set, and falls back to the request origin.\n\n| Prop      | Type                                        | Default    | Description                         |\n| --------- | ------------------------------------------- | ---------- | ----------------------------------- |\n| `post`    | `object`                                    | required   | Entry with `data.id`                |\n| `prefix`  | `string`                                    | `\"/s/\"`    | Must match the plugin's `prefix`    |\n| `showUrl` | `boolean`                                   | `false`    | Show the short URL next to the icon |\n| `variant` | `\"circle\" \\| \"pill\" \\| \"ghost\" \\| \"inline\"` | `\"circle\"` | Visual style                        |\n| `size`    | `\"sm\" \\| \"md\" \\| \"lg\"`                      | `\"md\"`     | Button size                         |\n| `theme`   | `\"auto\" \\| \"dark\" \\| \"light\"`               | `\"auto\"`   | Colour scheme                       |\n| `class`   | `string`                                    | -          | Extra CSS class                     |\n\nIt renders nothing when the entry has no id.\n\n| Token                           | Default                               |\n| ------------------------------- | ------------------------------------- |\n| `--plugdash-engage-size`        | `2rem`                                |\n| `--plugdash-engage-border`      | `rgb(from currentColor r g b / 0.15)` |\n| `--plugdash-engage-bg`          | `rgb(from currentColor r g b / 0.04)` |\n| `--plugdash-copy-success-color` | `#22c55e`                             |\n\n## Configuration\n\n```js\nshortlinkPlugin({ prefix: \"/go/\", pathPattern: \"/{collection}/{slug}\" });\n```\n\n| Option        | Type     | Default                  | Description                                                                                     |\n| ------------- | -------- | ------------------------ | ----------------------------------------------------------------------------------------------- |\n| `prefix`      | `string` | `\"/s/\"`                  | Path prefix for short links. Pass the same value to `CopyLink`.                                 |\n| `pathPattern` | `string` | `\"/{collection}/{slug}\"` | Destination when a collection has no URL pattern. Supports `{collection}`, `{slug}` and `{id}`. |\n\nIf you change `prefix`, also pass it to `<CopyLink prefix=\"/go/\" />`. Otherwise the button copies links that 404.\n\n## Capabilities\n\n`content:read`, `schema:read` (to read the collection's URL pattern) and `redirects:write`.\n\n## Upgrading from 0.2.x\n\n- Delete `src/pages/s/[code].astro`, along with any page that rendered `RedirectPage.astro`. EmDash's redirect engine handles `/s/<code>` now, so the page is no longer needed.\n- Remove `autoCreate` and any other old options from `shortlinkPlugin()`. The `@plugdash/shortlink/sandbox` and `RedirectPage.astro` exports are gone.\n- Old codes keep working. On an entry's next publish, if 0.2.x stored a code for it, the plugin adds a redirect for that old code as well.\n- Codes that were created by hand in the old admin table are not migrated. Add them in **Redirects** if you still need them.\n- See CHANGELOG.md for the full list.\n\n## What it does not do\n\n- Custom or vanity codes. Add those as regular redirects in the admin.\n- Remove a redirect when its entry is unpublished or deleted. Disable it in **Redirects**.\n- Click analytics beyond EmDash's hit count and last-hit time.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}