Skip to content

feat(themes): add social share buttons to posts#126

Merged
x3ek merged 5 commits into
mainfrom
feat/12-social-share-links
Jul 3, 2026
Merged

feat(themes): add social share buttons to posts#126
x3ek merged 5 commits into
mainfrom
feat/12-social-share-links

Conversation

@x3ek

@x3ek x3ek commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Closes #12

Share buttons on post pages across all three bundled themes: Twitter/X, LinkedIn, Facebook, Reddit, Hacker News, Email, plus a copy-link button.

  • Shared share_urls Jinja filter builds the links from the existing canonical_url with full percent-encoding (unicode titles included); returns empty when site.url is unset so the section hides entirely
  • One shared partial (themes/default/_share.html) with inline SVG icons and a few lines of clipboard JS (navigator.clipboard with an execCommand fallback); blue-tech and terminal include it via the loader's default-theme fallback, zero duplication, content repos can override it
  • Direct share URLs only, no tracking scripts or widgets; rel="noopener noreferrer" on external links; per-theme CSS matching each theme's look
  • 16 tests: platform set and order, encoding edge cases, hidden case, and render tests across all three themes

Browser-verified on all three themes: share row renders in each theme's style, copy button shows its feedback state, links are correctly encoded, and the section is absent when site.url is not configured.

🤖 Generated with Claude Code

Adds a share_urls Jinja2 filter yielding (platform, url) pairs for
Twitter/X, LinkedIn, Facebook, Reddit, Hacker News, and Email with
percent-encoded title and canonical URL. A shared _share.html partial
in the default theme renders icon buttons plus a copy-link button
(navigator.clipboard with execCommand fallback); blue-tech and
terminal include it via loader fallback and style it per theme.
Section is hidden entirely when site.url is not configured.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@x3ek x3ek added this to the SquishMark 1.0 milestone Jul 3, 2026
@x3ek x3ek requested a review from Copilot July 3, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds first-party social sharing to SquishMark’s bundled post themes by introducing a shared Jinja partial and a new share_urls filter that generates fully percent-encoded platform URLs from the render context’s canonical_url. This keeps sharing privacy-friendly (direct links only) while allowing themes/content repos to override the partial if desired.

Changes:

  • Add share_urls Jinja filter to generate ordered (platform, url) share links with strict percent-encoding.
  • Introduce a shared _share.html partial (default theme) and include it from post.html in all bundled themes via loader fallback.
  • Add per-theme CSS for the share row/buttons and add tests covering filter behavior + rendering across themes.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
themes/terminal/static/css/style.css Adds terminal theme styling for share buttons.
themes/terminal/post.html Includes shared share partial and sets a terminal-specific label.
themes/default/static/style.css Adds default theme styling for share buttons.
themes/default/post.html Includes shared share partial on post pages.
themes/default/_share.html New shared partial rendering share links + copy-link behavior.
themes/blue-tech/static/style.css Adds blue-tech theme styling for share buttons.
themes/blue-tech/post.html Includes shared share partial on post pages.
tests/test_share_urls.py Adds unit + render tests for share_urls and share section visibility.
src/squishmark/services/theme/filters.py Implements and registers the share_urls filter.
.claude/skills/theme-creator/references/filters.md Documents the new filter and how themes include the partial.

Comment thread themes/default/_share.html
@x3ek x3ek merged commit eabd895 into main Jul 3, 2026
5 checks passed
@x3ek x3ek deleted the feat/12-social-share-links branch July 3, 2026 17:39
@x3ek x3ek mentioned this pull request Jul 3, 2026
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.

Social sharing links

2 participants