Skip to content

Conversation

@yashovardhan
Copy link
Member

@yashovardhan yashovardhan commented Nov 3, 2025

Add discourse comment feature in Tutorials for syncing with Builder Hub


Note

Integrates Discourse comments into tutorial pages with topic lookup/embedding and teaser rendering, adds per-tutorial topic IDs, and enriches Open Graph image metadata.

  • Tutorials: Discourse comments integration
    • Add Discourse envs to customFields in docusaurus.config.js.
    • Overhaul src/components/DiscourseComment to normalize URLs, look up topics via Discourse API, load clean embeds, and render optional teaser content.
    • Update src/theme/MDXPage to extract first-paragraph teasers from MDX, pass page metadata/topic ID to DiscourseComment, and use absolute cover image URLs.
    • Add discourseTopicId frontmatter to multiple src/pages/tutorials/* files to bind pages to forum topics.
  • SEO
    • Enhance Open Graph image tags in src/components/SEO (secure URL, type, dimensions, alt).

Written by Cursor Bugbot for commit ce89d44. This will update automatically on new commits. Configure here.

@yashovardhan yashovardhan requested review from a team as code owners November 3, 2025 17:11
@vercel
Copy link

vercel bot commented Nov 3, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
metamask-docs Ready Ready Preview Comment Nov 11, 2025 4:57pm

cursor[bot]

This comment was marked as outdated.

@yashovardhan yashovardhan force-pushed the feat/tutorial-builder-hub branch from ba6576b to e96e742 Compare November 4, 2025 13:53
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@alexandratran alexandratran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, this PR will add a discourse comments section underneath each tutorial page, without affecting other parts of the UX? And this can't be previewed, only viewed once merged into production?

One comment I have is I'm not a fan of including the tutorial cover image at the top of each page. The text in the cover is the same as the already displayed title in most cases, so it feels redundant and takes up a lot of space.

Image

}

initializeEmbed()
}, [postUrl, discourseTopicId, DISCOURSE_API_KEY])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Stale Closures from Incomplete Effect Dependencies

The useEffect dependency array is incomplete. The effect uses several variables that are not included in the dependencies: DISCOURSE_API_USERNAME, DISCOURSE_CATEGORY_ID, and metadata. Additionally, the functions findDiscussionTopic, loadCleanEmbed, searchExistingTopic, and normalizeEmbedUrl are defined in the component body and reference these variables, but React's exhaustive-deps rule would flag this. This can cause stale closures where the effect uses old values of these variables when they change, leading to incorrect API calls or search logic.

Fix in Cursor Fix in Web

@yashovardhan
Copy link
Member Author

To clarify, this PR will add a discourse comments section underneath each tutorial page, without affecting other parts of the UX? And this can't be previewed, only viewed once merged into production?

One comment I have is I'm not a fan of including the tutorial cover image at the top of each page. The text in the cover is the same as the already displayed title in most cases, so it feels redundant and takes up a lot of space.

Image

aah sorry for adding this, fixing now.

date,
wrapperClassName,
communityPortalTopicId,
discourse_topic_id,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Domain Mismatch Breaks Social Sharing

The url variable is constructed with https://metamask.io domain, but the site actually runs on https://docs.metamask.io. This causes social sharing links (Facebook, Twitter) and the copy-to-clipboard feature to generate incorrect URLs pointing to metamask.io instead of docs.metamask.io, breaking the sharing functionality for tutorial pages.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants