{"id":13811028,"url":"https://github.com/spences10/svead","last_synced_at":"2025-03-15T11:32:01.259Z","repository":{"id":36965213,"uuid":"492505127","full_name":"spences10/svead","owner":"spences10","description":"Svead, a component that allows you to set head meta information, canonical, title, Twitter and Facebook Open Graph tags.","archived":false,"fork":false,"pushed_at":"2024-04-12T22:04:36.000Z","size":1263,"stargazers_count":57,"open_issues_count":14,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-13T20:49:57.067Z","etag":null,"topics":["canonical","component","head","links","metatags","svelte","sveltekit"],"latest_commit_sha":null,"homepage":"https://svead.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/spences10.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-05-15T14:07:07.000Z","updated_at":"2024-04-14T23:42:10.981Z","dependencies_parsed_at":"2023-02-13T19:30:22.190Z","dependency_job_id":"79276858-3df1-46f8-9101-b6151bbd6917","html_url":"https://github.com/spences10/svead","commit_stats":{"total_commits":204,"total_committers":3,"mean_commits":68.0,"dds":0.4607843137254902,"last_synced_commit":"b947f055554693781e686712b0b36ebf4c5c1153"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spences10%2Fsvead","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spences10%2Fsvead/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spences10%2Fsvead/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spences10%2Fsvead/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spences10","download_url":"https://codeload.github.com/spences10/svead/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221572741,"owners_count":16845711,"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","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":["canonical","component","head","links","metatags","svelte","sveltekit"],"created_at":"2024-08-04T03:00:35.811Z","updated_at":"2024-10-26T19:37:42.593Z","avatar_url":"https://github.com/spences10.png","language":"TypeScript","funding_links":[],"categories":["Sites","TypeScript"],"sub_categories":[],"readme":"# Svead 🍺 - Svelte Head Component\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n[![MadeWithSvelte.com shield](https://madewithsvelte.com/storage/repo-shields/4099-shield.svg)](https://madewithsvelte.com/p/svead/shield-link)\n\n[![Tests: E2E](https://github.com/spences10/svead/actions/workflows/e2e-ci.yml/badge.svg)](https://github.com/spences10/svead/actions/workflows/e2e-ci.yml)\n\n[![Tests: Unit](https://github.com/spences10/svead/actions/workflows/unit-test.yml/badge.svg)](https://github.com/spences10/svead/actions/workflows/unit-test.yml)\n\nSvead, a component that allows you to set head meta information,\ncanonical, title, Twitter and Facebook Open Graph tags.\n\nAlso supports JSON-LD for SEO with the `SchemaOrg` component.\n\n![svead](.github/svead.svg)\n\n## Name\n\nThe name was meant to be Svelte + Head, but I like Puru's suggestion\nof Svelte + Mead\n\n## v0.0.4 vs v1\n\nv1 is currently available via `pnpm i -D svead@next` and will be that\nway until Svelte 5 comes out of RC phase.\n\nv1 has changed compared to v0.0.4. The main change is that the there's\none config object with `SeoConfig`.\n\nSeparated out the `SchemaOrg` component from the `Head` component\nwhich can be optionally used to add structured data to your web pages.\n\n```svelte\n\u003cscript lang=\"ts\"\u003e\n\timport { Head, SchemaOrg } from 'svead';\n\timport type { SeoConfig, SchemaOrgProps } from 'svead';\n\n\tconst seo_config: SeoConfig = {\n\t\ttitle: 'Welcome to My Site',\n\t\tdescription: 'This is a simple web page example.',\n\t\turl: 'https://example.com/welcome',\n\t};\n\n\tconst schema_org: SchemaOrgProps['schema'] = {\n\t\t'@type': 'WebPage',\n\t\tname: 'Welcome to My Site',\n\t\tdescription: 'This is a simple web page example.',\n\t\turl: 'https://example.com/welcome',\n\t};\n\u003c/script\u003e\n\n\u003cHead {seo_config} /\u003e\n\u003cSchemaOrg schema={schema_org} /\u003e\n\n\u003ch1\u003eWelcome to My Site\u003c/h1\u003e\n\u003cp\u003eThis is a simple web page example.\u003c/p\u003e\n```\n\n## Props\n\nIt takes the following props:\n\n### `SeoConfig` Props\n\n| Property            | Type               | Description                                                  | Required |\n| :------------------ | :----------------- | :----------------------------------------------------------- | :------- |\n| `title`             | `string`           | The title of the web page.                                   | Yes      |\n| `description`       | `string`           | A description of the web page.                               | Yes      |\n| `url`               | `string`           | The URL of the web page.                                     | Yes      |\n| `website`           | `string`           | The website the web page belongs to.                         | No       |\n| `language`          | `string` \\| `'en'` | The language of the web page. Defaults to 'en'.              | No       |\n| `open_graph_image`  | `string`           | The URL of an image to use for Open Graph meta tags.         | No       |\n| `payment_pointer`   | `string`           | A payment pointer for Web Monetization.                      | No       |\n| `author_name`       | `string`           | The name of the author.                                      | No       |\n| `site_name`         | `string`           | The name of the site for og:site_name.                       | No       |\n| `twitter_handle`    | `string`           | The Twitter handle of the content creator or site.           | No       |\n| `twitter_card_type` | `string`           | The type of Twitter card. Defaults to 'summary_large_image'. | No       |\n\n## SchemaOrg Component\n\nThe SchemaOrg component allows you to add structured data to your web\npages using JSON-LD format. This helps search engines better\nunderstand your content and can potentially improve your site's\nappearance in search results.\n\n### Usage\n\n```svelte\n\u003cscript lang=\"ts\"\u003e\n\timport { SchemaOrg, type SchemaOrgProps } from 'svead';\n\n\tconst schema_org: SchemaOrgProps['schema'] = {\n\t\t'@type': 'BlogPosting',\n\t\theadline: 'My First Blog Post',\n\t\tdescription: 'This is an example of a blog post using svead.',\n\t\tauthor: {\n\t\t\t'@type': 'Person',\n\t\t\tname: 'John Doe',\n\t\t},\n\t\tdatePublished: '2023-08-22T10:00:00Z',\n\t};\n\u003c/script\u003e\n\n\u003cSchemaOrg schema={schema_org} /\u003e\n```\n\n### `SchemaOrgProps` Props\n\n| Property | Type            | Description                                                 | Required |\n| :------- | :-------------- | :---------------------------------------------------------- | :------- |\n| `schema` | `SchemaOrgType` | The structured data object following schema.org vocabulary. | Yes      |\n\n### `SchemaOrgType`\n\n`SchemaOrgType` is a union type that includes:\n\n- `Thing`: Represents the most generic type of item in schema.org.\n- `WithContext\u003cThing\u003e`: A Thing with an added `@context` property.\n\nYou can use any valid schema.org type as defined in the\n[schema.org documentation](https://schema.org).\n\n### Additional Notes:\n\n- The `@context` property is automatically added by the component if\n  not provided.\n- You can include multiple schema types by nesting them within the\n  main schema object.\n- Always validate your structured data using tools like\n  [Google's Rich Results Test](https://search.google.com/test/rich-results)\n  to ensure it's correctly formatted.\n\n### Example with Multiple Schema Types\n\n```svelte\n\u003cscript lang=\"ts\"\u003e\n\timport { SchemaOrg, type SchemaOrgProps } from 'svead';\n\n\tconst schema_org: SchemaOrgProps['schema'] = {\n\t\t'@type': 'WebPage',\n\t\tname: 'My Blog Post',\n\t\tdescription: 'An example blog post with structured data',\n\t\tmainEntity: {\n\t\t\t'@type': 'BlogPosting',\n\t\t\theadline: 'My First Blog Post',\n\t\t\tauthor: {\n\t\t\t\t'@type': 'Person',\n\t\t\t\tname: 'John Doe',\n\t\t\t},\n\t\t\tdatePublished: '2023-08-22T10:00:00Z',\n\t\t},\n\t};\n\u003c/script\u003e\n\n\u003cSchemaOrg schema={schema_org} /\u003e\n```\n\n## Packaging for NPM\n\nScott, this is here for you to remember how to do this 🙃\n\nAlthough I detailed this in\n[Making npm Packages with SvelteKit](https://scottspence.com/posts/making-npm-packages-with-sveltekit)\nI think it's best to put it here as I always come to the README and\nthe instructions are never there! 😅\n\n**Publish the project to NPM**\n\n```bash\n# change to package directory\ncd packages/svead\n# authenticate with npm\nnpm login\n# bump version with npm\nnpm version 0.0.8\n# package with sveltekit\npnpm run package\n# publish\nnpm publish\n# push tags to github\ngit push --tags\n```\n\n**Publish @next package**\n\nSame procedure except use the `--tag` flag:\n\n```bash\n# change to package directory\ncd packages/svead\n# authenticate with npm\nnpm login\n# bump version with npm\nnpm version 0.0.13\n# package with sveltekit\npnpm run package\n# publish with tag\nnpm publish --tag next\n# push tags to github\ngit push --tags\n```\n\n**Move @next package to latest**\n\n```bash\n# authenticate with npm\nnpm login\n# move @next to latest\nnpm dist-tag add svead@0.0.13 latest\n```\n\n## pnpm workspaces\n\nTo add the `svead` package to the `web` workspace:\n\n```bash\npnpm add -D svead --filter web\n```\n\n## Contributors ✨\n\nThanks goes to these wonderful people\n([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://scottspence.com/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/234708?v=4?s=100\" width=\"100px;\" alt=\"Scott Spence\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eScott Spence\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/spences10/svead/commits?author=spences10\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/spences10/svead/commits?author=spences10\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#example-spences10\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"#maintenance-spences10\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/spences10/svead/commits?author=spences10\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n  \u003ctfoot\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" size=\"13px\" colspan=\"7\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg\"\u003e\n          \u003ca href=\"https://all-contributors.js.org/docs/en/bot/usage\"\u003eAdd your contributions\u003c/a\u003e\n        \u003c/img\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tfoot\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the\n[all-contributors](https://github.com/all-contributors/all-contributors)\nspecification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspences10%2Fsvead","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspences10%2Fsvead","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspences10%2Fsvead/lists"}