{"id":15022961,"url":"https://github.com/vimtor/eleventy-plugin-external-links","last_synced_at":"2025-08-06T08:25:48.382Z","repository":{"id":51318489,"uuid":"326447481","full_name":"vimtor/eleventy-plugin-external-links","owner":"vimtor","description":"Eleventy plugin to make all external links open securely in a new tab","archived":false,"fork":false,"pushed_at":"2024-12-31T17:17:01.000Z","size":14,"stargazers_count":10,"open_issues_count":3,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-04T16:16:45.457Z","etag":null,"topics":["eleventy","eleventy-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/eleventy-plugin-external-links","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vimtor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-03T16:12:42.000Z","updated_at":"2025-02-06T06:47:52.000Z","dependencies_parsed_at":"2022-08-24T00:51:18.108Z","dependency_job_id":null,"html_url":"https://github.com/vimtor/eleventy-plugin-external-links","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/vimtor/eleventy-plugin-external-links","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimtor%2Feleventy-plugin-external-links","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimtor%2Feleventy-plugin-external-links/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimtor%2Feleventy-plugin-external-links/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimtor%2Feleventy-plugin-external-links/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vimtor","download_url":"https://codeload.github.com/vimtor/eleventy-plugin-external-links/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vimtor%2Feleventy-plugin-external-links/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269044768,"owners_count":24350261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eleventy","eleventy-plugin"],"created_at":"2024-09-24T19:58:34.960Z","updated_at":"2025-08-06T08:25:48.336Z","avatar_url":"https://github.com/vimtor.png","language":"JavaScript","readme":"# eleventy-plugin-external-links\n\nEleventy plugin to make all external links open securely in a new tab\n\n```shell script\nnpm install -D eleventy-plugin-external-links\n```\n\nThen simply add it to you eleventy config\n\n```js\nconst externalLinks = require('eleventy-plugin-external-links')\n\nmodule.exports = (eleventyConfig) =\u003e {\n    eleventyConfig.addPlugin(externalLinks, {\n        // Plugin defaults:\n        name: 'external-links',         // Plugin name\n        regex: /^(([a-z]+:)|(\\/\\/))/i,  // Regex that test if href is external\n        target: \"_blank\",               // 'target' attribute for external links\n        rel: \"noopener\",                // 'rel' attribute for external links\n        extensions: [\".html\"],          // Extensions to apply transform to\n        includeDoctype: true,           // Default to include '\u003c!DOCTYPE html\u003e' at the beginning of the file\n    })\n}\n```\n\nUnder the hood it adds a simple transform that:\n\n1. Checks the file extension\n2. Parses the file using [node-html-parser](https://www.npmjs.com/package/node-html-parser)\n3. Finds all the `\u003ca /\u003e` tags which `href` matches regex\n4. Add `target` and `rel` attributes to the elements\n5. Return the content with '\u003c!DOCTYPE html\u003e' added at the beginning of the file as default\n\nThe default regex will detect links as follows:\n\n| Link | External |\n| ---- | -------- |\n| http://google.com | ✔ |\n| https://google.com | ✔ |\n| //google.com | ✔ |\n| mailto:mail@example.com | ✔ |\n| /about |  ❌ |\n| image.jpg |  ❌ |\n| #anchor |  ❌ |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvimtor%2Feleventy-plugin-external-links","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvimtor%2Feleventy-plugin-external-links","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvimtor%2Feleventy-plugin-external-links/lists"}