{"id":36543898,"url":"https://github.com/umsungjun/react-head-safe","last_synced_at":"2026-01-15T02:57:12.923Z","repository":{"id":332029893,"uuid":"1128730277","full_name":"umsungjun/react-head-safe","owner":"umsungjun","description":"A CSR-only React head manager that prevents duplicate meta tags and safely manages document head elements.","archived":false,"fork":false,"pushed_at":"2026-01-12T04:44:52.000Z","size":227,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T12:48:11.192Z","etag":null,"topics":["csr","head","meta","react","seo"],"latest_commit_sha":null,"homepage":"https://react-head-safe.vercel.app/","language":"TypeScript","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/umsungjun.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-06T04:27:53.000Z","updated_at":"2026-01-12T04:44:57.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/umsungjun/react-head-safe","commit_stats":null,"previous_names":["umsungjun/react-head-safe"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/umsungjun/react-head-safe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umsungjun%2Freact-head-safe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umsungjun%2Freact-head-safe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umsungjun%2Freact-head-safe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umsungjun%2Freact-head-safe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/umsungjun","download_url":"https://codeload.github.com/umsungjun/react-head-safe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/umsungjun%2Freact-head-safe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441849,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"online","status_checked_at":"2026-01-15T02:00:08.019Z","response_time":62,"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":["csr","head","meta","react","seo"],"created_at":"2026-01-12T05:53:52.805Z","updated_at":"2026-01-15T02:57:12.918Z","avatar_url":"https://github.com/umsungjun.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-head-safe\n\n[English](README.md) | [한국어](README.ko.md)\n\nA CSR-only React head manager that prevents duplicate meta tags and safely manages document head elements.\n\n## Why react-head-safe?\n\nA lightweight, CSR-focused alternative for managing document head elements in React. Perfect for simple client-side rendered applications that need:\n\n- **Explicit duplicate prevention** - Always removes existing meta tags before adding new ones\n- **Simplicity** - Just a single component with props, no complex setup\n- **Performance** - Uses `useLayoutEffect` for synchronous DOM updates before paint\n- **Type safety** - Written in TypeScript with full type definitions\n\n## Features\n\n- ✅ **No Duplicate Tags** - Removes existing meta tags before creating new ones\n- ✅ **TypeScript Support** - Full type safety with TypeScript\n- ✅ **Lightweight** - Zero dependencies except React\n- ✅ **CSR Optimized** - Uses `useLayoutEffect` for synchronous DOM updates\n- ✅ **Open Graph Support** - Built-in support for social media meta tags\n- ✅ **Simple API** - Just pass props, no complex configuration\n\n## Installation\n\n[![npm version](https://badge.fury.io/js/react-head-safe.svg)](https://www.npmjs.com/package/react-head-safe)\n\n```bash\nnpm install react-head-safe\n# or\nyarn add react-head-safe\n# or\npnpm add react-head-safe\n```\n\n## Usage\n\n```tsx\nimport { ReactHeadSafe } from 'react-head-safe';\n\nfunction MyPage() {\n  return (\n    \u003c\u003e\n      \u003cReactHeadSafe\n        title=\"My Page Title\"\n        description=\"This is the page description for SEO.\"\n        keywords=\"react,seo,meta tags\"\n        ogTitle=\"My Page Title for Social Media\"\n        ogDescription=\"This is the description for social media.\"\n        ogImage=\"https://example.com/image.jpg\"\n      /\u003e\n      \u003cdiv\u003eYour page content...\u003c/div\u003e\n    \u003c/\u003e\n  );\n}\n```\n\n## API\n\n### ReactHeadSafeProps\n\n| Prop            | Type     | Description                                                          |\n| --------------- | -------- | -------------------------------------------------------------------- |\n| `title`         | `string` | The page title that will be set in the `document.title`              |\n| `description`   | `string` | The meta description tag content for SEO                             |\n| `keywords`      | `string` | The meta keywords tag content for SEO                                |\n| `ogTitle`       | `string` | The Open Graph title (og:title) for social media sharing             |\n| `ogDescription` | `string` | The Open Graph description (og:description) for social media sharing |\n| `ogImage`       | `string` | The Open Graph image URL (og:image) for social media sharing         |\n\n## When to Use\n\n**Use react-head-safe if:**\n\n- You're building a CSR-only application (Create React App, Vite, etc.)\n- You want a simple, lightweight solution with minimal setup\n- You need explicit control over duplicate meta tag prevention\n- You prefer `useLayoutEffect` for synchronous DOM updates\n\n**Use alternatives if:**\n\n- You need SSR/SSG support → use `react-helmet-async`, Next.js `\u003cHead\u003e`, or Remix `\u003cMeta\u003e`\n- You need advanced features like nested components or deduplication logic\n- You're already using a framework with built-in head management\n\n## Why CSR Only?\n\nThis library is specifically designed for **Client-Side Rendering (CSR)** applications. If you need Server-Side Rendering (SSR) support, consider using:\n\n- `react-helmet-async` for SSR\n- Next.js built-in `\u003cHead\u003e` component\n- Remix `\u003cMeta\u003e` component\n\n## Local Development\n\nTo test your local changes with the example application:\n\n```bash\npnpm run example\n```\n\n## Testing\n\n[![codecov](https://codecov.io/gh/umsungjun/react-head-safe/branch/main/graph/badge.svg)](https://codecov.io/gh/umsungjun/react-head-safe)\n\nThis project uses **Vitest** and **React Testing Library** for unit testing.\n\n### Running Tests\n\n```bash\n# Run tests once\npnpm test\n\n# Run tests in watch mode\npnpm test:watch\n\n# Run tests with coverage\npnpm test:coverage\n\n# Run tests with UI\npnpm test:ui\n```\n\n### CI/CD\n\nThe project uses GitHub Actions for continuous integration:\n\n- ✅ **Automated Testing** - Tests run on every PR and push to main\n- ✅ **Node.js 20.x** - Tests against Node.js 20.x (LTS)\n- ✅ **Build Verification** - Ensures the package builds correctly\n- ✅ **Branch Protection** - Tests must pass before merging to main\n\nAll tests must pass before a PR can be merged to the main branch.\n\nThis command will run the example project using your local version of the library, allowing you to test any modifications you've made before publishing.\n\n## License\n\n[MIT](LICENSE)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumsungjun%2Freact-head-safe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumsungjun%2Freact-head-safe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumsungjun%2Freact-head-safe/lists"}