{"id":18561238,"url":"https://github.com/apostrophecms/open-graph","last_synced_at":"2025-04-10T02:31:32.818Z","repository":{"id":46085678,"uuid":"375052281","full_name":"apostrophecms/open-graph","owner":"apostrophecms","description":"Open Graph tools for Apostrophe 3","archived":false,"fork":false,"pushed_at":"2025-04-02T09:03:58.000Z","size":32,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T10:23:11.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/apostrophecms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2021-06-08T15:08:11.000Z","updated_at":"2024-09-05T21:04:53.000Z","dependencies_parsed_at":"2024-03-18T16:11:44.756Z","dependency_job_id":"5406a1f5-c947-46e0-a952-80975fc23dad","html_url":"https://github.com/apostrophecms/open-graph","commit_stats":{"total_commits":23,"total_committers":6,"mean_commits":"3.8333333333333335","dds":0.4347826086956522,"last_synced_commit":"f021f9a8f0a31f66365113b83c7ea83b735394ab"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fopen-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fopen-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fopen-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fopen-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostrophecms","download_url":"https://codeload.github.com/apostrophecms/open-graph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144212,"owners_count":21054886,"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":[],"created_at":"2024-11-06T22:06:17.964Z","updated_at":"2025-04-10T02:31:32.391Z","avatar_url":"https://github.com/apostrophecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/apostrophecms/apostrophe/main/logo.svg\" alt=\"ApostropheCMS logo\" width=\"80\" height=\"80\"\u003e\n\n  \u003ch1\u003eOpen Graph for ApostropheCMS\u003c/h1\u003e\n  \u003cp\u003e\n    \u003ca aria-label=\"Apostrophe logo\" href=\"https://docs.apostrophecms.org\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/MADE%20FOR%20ApostropheCMS-000000.svg?style=for-the-badge\u0026logo=Apostrophe\u0026labelColor=6516dd\"\u003e\n    \u003c/a\u003e\n    \u003ca aria-label=\"Join the community on Discord\" href=\"http://chat.apostrophecms.org\"\u003e\n      \u003cimg alt=\"\" src=\"https://img.shields.io/discord/517772094482677790?color=5865f2\u0026label=Join%20the%20Discord\u0026logo=discord\u0026logoColor=fff\u0026labelColor=000\u0026style=for-the-badge\u0026logoWidth=20\"\u003e\n    \u003c/a\u003e\n    \u003ca aria-label=\"License\" href=\"https://github.com/apostrophecms/blog/blob/main/LICENSE.md\"\u003e\n      \u003cimg alt=\"\" src=\"https://img.shields.io/static/v1?style=for-the-badge\u0026labelColor=000000\u0026label=License\u0026message=MIT\u0026color=3DA639\"\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\n## Installation\n\n```bash\nnpm install @apostrophecms/open-graph\n```\n\n## Use\n\nConfigure `@apostrophecms/open-graph` in `app.js`.\n\n```js\nconst apos = require('apostrophe')({\n  shortName: 'project',\n  modules: {\n    '@apostrophecms/open-graph': {}\n  }\n});\n```\n\n### Setting the `baseUrl`\n\nOpen Graph images *will not be set* with absolute URLs if the `baseUrl` is not set. This should either be set statically in `app.js`, but more likely, in the environment configuration, such as in `data/local.js`. Some social media platforms consider an aboslute URL to be a requirement and *will not accept the image URL without it*.\n\n#### In `app.js` as part of your main Apostrophe app\n```js\nrequire('apostrophe')({\n  shortName: 'mysite',\n  baseUrl: 'https://mysite.com',\n  modules: {\n    // other module configurations\n  }\n});\n```\n#### As part of an environment configuration in `data/local.js`\n```js\n  module.exports = {\n    baseUrl: 'https://mysite.com',\n    modules: {\n      // other environment-specific module configurations\n    }\n  };\n```\n### Opting out of Open Graph Fields\n\nAdding `openGraph: false` to any module will prevent Open Graph fields from being added. Good use cases for this are utility modules, special page types, or piece types that don't have index or show pages.\n\n```js\nrequire('apostrophe')({\n  shortName: 'mysite',\n  baseUrl: 'https://mysite.com',\n  modules: {\n    category: {\n      options: {\n        openGraph: false;\n      }\n    }\n  }\n});\n```\n\nThe following modules opt out of the Open Graph fields by default:\n - `@apostrophecms/global`\n - `@apostrophecms/user`\n - `@apostrophecms/image`\n - `@apostrophecms/image-tag`\n - `@apostrophecms/file`\n - `@apostrophecms/file-tag`\n\n### Field Reference\nThe following are the fields that are added to pieces and pages\n\n|Name |Description  | Module Effected |\n--- | --- | --- \n|`openGraphTitle`|OG Title, populates `\u003cmeta property=\"og:title\" /\u003e`|`@apostrophecms/doc-type`\n|`openGraphDescription`|OG Description, populates `\u003cmeta property=\"og:description\" /\u003e`|`@apostrophecms/doc-type`\n|`openGraphType`|OG Type, populates `\u003cmeta property=\"og:type\" /\u003e`, defaults to 'website'|`@apostrophecms/doc-type`\n|`openGraphImage`|OG Image, populates `\u003cmeta property=\"og:image\" /\u003e`|`@apostrophecms/doc-type`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fopen-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostrophecms%2Fopen-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fopen-graph/lists"}