{"id":31552354,"url":"https://github.com/matt-goldman/blakeplugin.opengraph","last_synced_at":"2026-01-20T17:27:20.511Z","repository":{"id":310714152,"uuid":"1040974378","full_name":"matt-goldman/BlakePlugin.OpenGraph","owner":"matt-goldman","description":"A Blake plugin that generates OpenGraph meta tags for generated pages","archived":false,"fork":false,"pushed_at":"2025-09-03T19:44:32.000Z","size":157953,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-28T05:26:49.537Z","etag":null,"topics":["blake","blazor","open-graph","ssg","static-site-generator"],"latest_commit_sha":null,"homepage":"","language":"C#","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/matt-goldman.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}},"created_at":"2025-08-19T19:38:04.000Z","updated_at":"2025-09-03T19:44:36.000Z","dependencies_parsed_at":"2025-08-19T20:48:02.945Z","dependency_job_id":"6252e97e-0bca-4533-a7e6-81871ef046fa","html_url":"https://github.com/matt-goldman/BlakePlugin.OpenGraph","commit_stats":null,"previous_names":["matt-goldman/blakeplugin.opengraph"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matt-goldman/BlakePlugin.OpenGraph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-goldman%2FBlakePlugin.OpenGraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-goldman%2FBlakePlugin.OpenGraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-goldman%2FBlakePlugin.OpenGraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-goldman%2FBlakePlugin.OpenGraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matt-goldman","download_url":"https://codeload.github.com/matt-goldman/BlakePlugin.OpenGraph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matt-goldman%2FBlakePlugin.OpenGraph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278366633,"owners_count":25975090,"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-10-04T02:00:05.491Z","response_time":63,"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":["blake","blazor","open-graph","ssg","static-site-generator"],"created_at":"2025-10-04T19:52:58.273Z","updated_at":"2025-10-04T19:53:01.789Z","avatar_url":"https://github.com/matt-goldman.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blake OpenGraph Plugin (per‑route shells for social previews)\n\nAdd correct Open Graph tags to every Blake‑generated page without SSR, prerender, or edge functions. The plugin emits a small, standalone HTML \"shell\" per page at `/.../index.html` so social scrapers (which don’t run JS) get the right `\u003chead\u003e` on first byte.\n\n**Scope:** _only_ pages Blake generates from markdown. The site’s home page (`wwwroot/index.html`) is **not** modified.\n\n## What does it do\n\nBlazor WASM (and most SPAs) inject `\u003cHeadContent\u003e` after the app boots. Social bots (Facebook, X/Twitter, LinkedIn, Slack, Discord, etc.) don’t execute JS, so they miss your OG tags. This plugin solves that by baking a per‑route HTML shell containing the correct meta, while retaining the Blazor UX.\n\n* Reads existing shell from `wwwroot/index.html`.\n* Builds a compact SEO/social `\u003chead\u003e` block per content page (title, description, canonical, `og:*`).\n* Writes a per‑page shell to `wwwroot/\u003cslug\u003e/index.html`.\n* Leaves your home page and the rest of your app untouched.\n\n**Result:**\n\n* Bots fetch `/posts/my-post/` and receive a real HTML file with the correct `\u003chead\u003e` immediately.\n* Humans (browsers) fetch the same URL and your Blazor app boots as normal.\n\n## Installation\n\n1. **Add the plugin** to your Blake site \n\n    ```bash\n    dotnet add package BlakePlugin.OpenGraph\n    ```\n\n2. **Bake** with the required options (see Configuration). Example:\n\n   ```bash\n   blake bake --social:baseurl=\"https://example.com\"\n   ```\n\n**Note:** You can omit the base URL argument in debug, but the plugin will not be able to generate absolute URLs for your Open Graph tags so you should include this in any CI builds.\n\nThe plugin writes files directly into your project’s `wwwroot/` so they’ll be included by `dotnet build` and whatever static host you use.\n\n### Optimisation\n\nYou don't need the output generated by this in your repo, and you usually don't need it when debugging. To optimise for this, I recommend adding a release condition to the package import:\n\n```xml\n\u003cItemGroup Condition=\"'$(Configuration)' == 'Release'\"\u003e\n  \u003cPackageReference Include=\"BlakePlugin.OpenGraph\" Version=\"*\" /\u003e\n\u003c/ItemGroup\u003e\n```\n\n## Configuration\n\n**Required (Production):**\n\n* `--social:baseurl`: Full origin used to build **absolute** URLs for `og:url`, `og:image`, and `canonical`.\n\n  * Examples: `https://example.com`, `https://user.github.io/repo`\n\n## Output\n\nFor each generated page, the plugin writes:\n\n```\nwwwroot/\n  posts/\n    post-title/\n      index.html   \u003c-- shell with correct \u003chead\u003e (OG/Twitter/canonical)\n```\n\nThe shell links to your existing CSS/JS; only the `\u003chead\u003e` differs per page.\n\n\u003e The home page (`wwwroot/index.html`) is not altered by this plugin.\n\n---\n\n## Meta set the plugin emits\n\nThe plugin uses [Blake standard frontmatter](https://blake-ssg.org/2%20using%20blake/authoringcontent#frontmatter) so there is no additional configuration required.\n\n```yaml\n# example.md\n---\ntitle: \"Post title\"\ndescription: \"Short summary for cards\"\nimage: \"/images/og/post-title.png\"  # optional; plugin makes absolute via baseurl\ntags: [\"example\", \"post\"]\n...etc.\n---\n```\n\nThe plugin emits the following meta tags for each generated page:\n\n* `\u003ctitle\u003e` - mapped from the `title` in frontmatter\n* `\u003cmeta name=\"description\"\u003e` - mapped from the `description` in frontmatter\n* `\u003clink rel=\"canonical\" href=\"ABSOLUTE_URL\"\u003e` - built from the page URL combined with the `baseurl`\n* `\u003cmeta property=\"og:type\" content=\"article\"\u003e` (content pages)\n* `\u003cmeta property=\"og:title\"\u003e` - mapped from the `title` in frontmatter\n* `\u003cmeta property=\"og:description\"\u003e` - mapped from the `description` in frontmatter\n* `\u003cmeta property=\"og:url\" content=\"ABSOLUTE_URL\"\u003e` - built from the page URL combined with the `baseurl`\n* `\u003cmeta property=\"og:image\" content=\"ABSOLUTE_URL\"\u003e` - built from the `image` in frontmatter (if present, omitted if not)\n\nValues are HTML‑escaped; URLs are normalized and made absolute using `baseurl`.\n\n\n## Validation checklist\n\n* **Curl:**\n\n  ```bash\n  curl -s https://example.com/posts/post-title/ | grep -i \"og:\"\n  ```\n* **Debuggers:** use Facebook Sharing Debugger, X Card Validator, and LinkedIn Post Inspector to refresh caches and verify cards.\n* **Image:** ensure your OG image returns 200, has proper `Content-Type`, is ≥ 1200×630, and \u003c \\~5 MB.\n\n---\n\n## Troubleshooting\n\n* **Missing per‑route file:** confirm the page’s `slug` and that the plugin ran during `blake bake`.\n* **Wrong URLs (nested paths):** set `--social:baseurl` or use rooted links in your app.\n* **Double slashes:** the plugin normalizes common `//` patterns; still prefer clean paths in front‑matter.\n* **No previews:** some platforms cache aggressively—use their debuggers to “scrape again.”\n\n## Limitations (by design)\n\n* The plugin only emits meta **in the head**. It does not SSR your page body.\n* The site home page is not modified (ensure you add your own meta tags there).\n* The plugin only handles Open Graph tags (i.e. no Twitter Cards).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-goldman%2Fblakeplugin.opengraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatt-goldman%2Fblakeplugin.opengraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatt-goldman%2Fblakeplugin.opengraph/lists"}