Improve social card UX, docs coverage, and metadata snippets#156
Improve social card UX, docs coverage, and metadata snippets#156PrzemyslawKlys merged 3 commits intomainfrom
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Code ReviewOverall this is a clean, well-scoped PR. The separation of top-right badge (category) from bottom-left chip (route label) is a good UX improvement. A few items worth addressing before merge: Likely Test Regression
var segments = normalized
.Split('/', StringSplitOptions.RemoveEmptyEntries)
.Length;
return segments <= 2; // "docs/guide" → 2 → trueThe new behavior is intentional per the PR description, but the test documents the old contract. It needs to be updated (or replaced with a test that verifies a deeper path, e.g., Footer Label Inconsistency Between Site and API CardsSite cards go through API cards use if (!value.StartsWith("/", StringComparison.Ordinal))
value = "/" + value;
return value.Trim('/'); // strips the slash we just added → "api", not "/api"As a result, API cards will render
|
|
Added a follow-up commit with the 3 requested enhancements:
Also improved snippet extraction for cleaner docs/blog social descriptions and updated Docs/PowerForge.Web.ContentSpec.md with examples. |
PR Review: Improve social card UX, docs coverage, and metadata snippetsOverall this is a well-structured PR with clear intent, good documentation, and consistent use of the existing code style. The precedence chain (per-page meta → collection config → global config → heuristics) is logical and well-documented. A few things worth looking at: Code duplication (DRY violation)
// WebSiteBuilder.SocialCards.cs
var combined = string.Concat(badge ?? string.Empty, " ", route ?? string.Empty).ToLowerInvariant();
if (combined.Contains("api", StringComparison.Ordinal)) return "api";
// ...
// WebSocialCardGenerator.cs – same logic, duplicated
var combined = string.Concat(badge ?? string.Empty, " ", footerLabel ?? string.Empty).ToLowerInvariant();
if (combined.Contains("api", StringComparison.Ordinal)) return "api";Same duplication exists between
|
|
Added follow-up social-card fitting fixes based on live IntelligenceX card regressions.\n\n### What changed\n- improved title/description wrapping for long CamelCase/API identifiers (removes awkward mid-token hyphen splits like Resu-lt)\n- added semantic badge/footer normalization in renderer so cards detect label intent better\n - long badge-like labels such as IntelligenceX API Reference collapse to API\n - footer labels normalize to route-like chips (/api, /docs, /showcase)\n - very long route labels are abbreviated (/api/.../type-slug)\n- capped footer chip max width to prevent oversized bottom pills\n- in API social generation, separated route key (hash/slug) from display label\n - keeps stable unique filenames while rendering concise footer chip labels\n\n### Validation\n- dotnet test PowerForge.Tests ... targeted social card tests passed (3/3)\n- rebuilt IntelligenceX website using this engine branch (POWERFORGE_ROOT override)\n- visually confirmed improved output for:\n - �pi-intelligencex-analysis-analysiscatalogvalidationresult-a427e35b22.png\n - showcase-ee2d6e3175.png\n - docs-getting-started-c23af94cf5.png\n\n### Note\n- existing test WebSiteSocialCardsTests.Build_DoesNotAutoGenerateCards_ForDocsPages_UnlessOverridden is already stale vs current docs-entry social-card behavior and still fails when run in the broad social suite (pre-existing mismatch). |
PR Review: Improve social card UX, docs coverage, and metadata snippetsOverall this is a well-structured PR with clear intent and good defensive coding (XML escaping, regex timeouts, path sanitization). The changes are focused and the documentation updates are thorough. A few items worth discussing: Code Duplication
Potential False Positives in Substring Matching
private static bool ContainsToken(string value, string token)
=> value.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0;This means:
Similarly
|
| Category | Finding | Severity |
|---|---|---|
| Code quality | InferSocialCardStyle/ClassifyStyle duplication |
Medium |
| Correctness | ContainsToken substring vs. word boundary |
Low |
| Correctness | LooksLikeApiReferenceLabel overly strict |
Low |
| Maintainability | Hardcoded palette indices without bounds comment | Low |
| Completeness | API doc cards ignore SocialSpec config |
Medium |
| Maintainability | Hardcoded "powershell" in route label builder |
Low |
| Reliability | Silent exception swallowing in NormalizeWrapInput |
Low |
| Testing | No unit tests for new logic | Medium |
The PR is in good shape for its stated scope. The docs coverage improvements and the cleaner separation of badge vs. route label are the most impactful changes. Addressing the duplication between site builder and card generator classification logic would be the highest-value cleanup.
Summary
HOME/DOCS/API/etc.)/,/docs,api, ...)api,docs,editorial, default)Validation
dotnet build .\\PowerForge.Web\\PowerForge.Web.csproj -c Releasedotnet build .\\PowerForge.Web.Cli\\PowerForge.Web.Cli.csproj -c Releasedoctorpassed in pipeline runNotes