Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Auto detect text files and perform LF normalization
* text=auto

# Visual Studio solution files are canonically CRLF. Pin the line-ending
# so cross-platform edits (mixed-OS contributors, scripted regenerators
# that emit LF, editors that drop the trailing CR on save) do not drift
# the file off the format Visual Studio + MSBuild expect.
*.sln text eol=crlf

# Custom for Visual Studio
*.cs diff=csharp

Expand Down
12 changes: 10 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import { defineConfig } from 'vitepress';
import { withMermaid } from 'vitepress-plugin-mermaid';
import { apiSidebar, referenceSidebar } from './sidebar';

// Absolute base URL for the deployed site. Social-card crawlers (LinkedIn,
// Slack unfurl, the classic X crawler) require absolute `https://…` URLs in
// og:image / twitter:image; root-relative paths are silently discarded.
// Override at workflow level via DOCS_CANONICAL_URL for custom domains.
const docsCanonicalUrl =
process.env.DOCS_CANONICAL_URL ?? 'https://trakhound.github.io/MTConnect.NET';
const ogImage = `${docsCanonicalUrl}/logo.png`;

/**
* VitePress config for the MTConnect.NET documentation site.
*
Expand Down Expand Up @@ -62,7 +70,7 @@ export default withMermaid(
'The .NET implementation of the MTConnect Standard — 100% public-surface API coverage, 100% MTConnect Standard compliance.',
},
],
['meta', { property: 'og:image', content: '/logo.png' }],
['meta', { property: 'og:image', content: ogImage }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
['meta', { name: 'twitter:title', content: 'MTConnect.NET' }],
[
Expand All @@ -72,7 +80,7 @@ export default withMermaid(
content: 'The .NET implementation of the MTConnect Standard.',
},
],
['meta', { name: 'twitter:image', content: '/logo.png' }],
['meta', { name: 'twitter:image', content: ogImage }],
],

themeConfig: {
Expand Down
6 changes: 6 additions & 0 deletions tests/MTConnect.NET-Docs-Tests/RouteCheckTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,22 @@ public async Task Landing_Page_Carries_The_House_Style_Surfaces()
"favicon type attribute is not 'image/png'");

// Open Graph — title + image surface so social previews render.
// og:image must be an absolute https:// URL; LinkedIn, Slack unfurl,
// and the classic X crawler reject root-relative paths for social cards.
Assert.That(probes.OgTitle, Is.EqualTo("MTConnect.NET"),
"og:title meta does not match the expected site title");
Assert.That(probes.OgImage, Is.Not.Null.And.Not.Empty, "og:image meta missing");
Assert.That(probes.OgImage, Does.StartWith("https://"),
$"og:image must be an absolute https:// URL for social-card crawlers — got '{probes.OgImage}'");
Assert.That(probes.OgImage, Does.EndWith("/logo.png"),
$"og:image does not point at /logo.png — got '{probes.OgImage}'");

// Twitter Card — large summary card with the same image.
Assert.That(probes.TwitterCard, Is.EqualTo("summary_large_image"),
"twitter:card meta is not 'summary_large_image'");
Assert.That(probes.TwitterImage, Is.Not.Null.And.Not.Empty, "twitter:image meta missing");
Assert.That(probes.TwitterImage, Does.StartWith("https://"),
$"twitter:image must be an absolute https:// URL for social-card crawlers — got '{probes.TwitterImage}'");
Assert.That(probes.TwitterImage, Does.EndWith("/logo.png"),
$"twitter:image does not point at /logo.png — got '{probes.TwitterImage}'");

Expand Down
Loading