Skip to content

feat: add Hugo and Jekyll integration guides and demo sections#151

Open
amankv1234 wants to merge 27 commits into
AOSSIE-Org:mainfrom
amankv1234:feature/hugo-jekyll-demo-cdn-guide
Open

feat: add Hugo and Jekyll integration guides and demo sections#151
amankv1234 wants to merge 27 commits into
AOSSIE-Org:mainfrom
amankv1234:feature/hugo-jekyll-demo-cdn-guide

Conversation

@amankv1234

@amankv1234 amankv1234 commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #51

Adds first-class support for Hugo and Jekyll Static Site Generators (SSGs). This implementation provides a seamless "drop-in" CDN approach, which is the preferred integration pattern for static environments.

Changes

  • Demo Page: Added a new "📄 Hugo / Jekyll Integration" section to index.html with functional snippets for both frameworks and copy-to-clipboard support.
  • README: Formalized Hugo/Jekyll support in the feature list and added a detailed step-by-step integration guide.
  • Optimization: Used defer scripts and DOMContentLoaded listeners to ensure high performance and reliability.
  • Fix: Corrected the CDN version tags to @v1.0.3 to ensure links work immediately.

Verification

  • Pass formatting: npm run format
  • Manual check: Verified that the new sections match the UI design of existing integrations.

Summary by CodeRabbit

  • New Features
    • Added a Nuxt.js Vue wrapper component for client-side initialization and prop-driven updates.
    • Added WordPress, Hugo, and Jekyll demo pages, along with expanded framework integration guidance (including Qwik/QwikCity).
  • Bug Fixes
    • Improved container resolution with safer validation and fallback behavior.
    • Clipboard “Copy” now captures all code blocks in the snippet and provides clearer success/failure messaging.
  • Documentation
    • Updated README integration instructions and CDN/version references to v1.0.3, including new copy-paste sections.
  • Chores
    • Formatting-only updates across docs, lint/format config, and stylesheets.

- Added try-catch blocks to createButton and _getContainer to handle invalid CSS selectors.
- Improved fallbackCopy error visibility by logging to _debugWarn.
- Fixed HTML syntax error in index.html (removed stray closing div).
- Removed duplicate CTA section in index.html for cleaner code.
- Ran project-wide formatting and linting.

Closes AOSSIE-Org#132
- Implemented defensive try-catch blocks for container selector resolution.
- Refactored createButton() to deduplicate logic via _getContainer() helper.
- Enhanced fallbackCopy() to log clipboard errors using the _debugWarn helper.
- Fixed a SyntaxError in index.html and removed a redundant CTA section.
- Ran project-wide formatting and linting for full code consistency.

Closes AOSSIE-Org#132
- Implemented defensive try-catch blocks for container selector resolution.
- Added DOM Element type safety check in _getContainer() to prevent crashes.
- Refactored createButton() to deduplicate logic via _getContainer() helper.
- Enhanced fallbackCopy() to log clipboard errors using the _debugWarn helper.
- Fixed a SyntaxError in index.html and removed a redundant CTA section.
- Ran project-wide formatting and linting for full code consistency.

Closes AOSSIE-Org#132
- Added a new 'WordPress Integration' section to index.html with step-by-step instructions.
- Included PHP code snippets for enqueuing assets in unctions.php via standard WordPress hooks (wp_enqueue_scripts, wp_footer).
- Implemented copy-to-clipboard functionality for the new code blocks.
- Updated README.md to list WordPress as a formally supported platform.

Fixes AOSSIE-Org#52, Fixes AOSSIE-Org#112
- Replaced raw => characters with the HTML-escaped => equivalent in the Qwik component code block within index.html.
- Resolves potential HTML linting/validation errors caused by raw greater-than signs inside <code> tags.
- Replaced incorrect npm CDN URLs with the correct jsDelivr + GitHub CDN
  pointing to AOSSIE-Org/SocialShareButton@v1.0.4 in both index.html and README.md.
- Updated wp_footer add_action priority from default (10) to 21 so enqueued
  footer scripts are printed before initialization runs.
- Added a note in README clarifying the package is not published to npm.
- Removed 	his._debugWarn logging inside the allbackCopy method's catch block within src/social-share-button.js.
- The failed copy action is now completely silent internally (since old browsers gracefully failing to copy isn't an unexpected app error), but still visually updates the UI button text to
@github-actions github-actions Bot added planned Planned feature - not final, may be dropped based on repo direction configuration Configuration file changes documentation Changes to documentation files frontend Changes to frontend code javascript JavaScript/TypeScript code changes labels Apr 20, 2026
@coderabbitai

coderabbitai Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds Nuxt.js wrapper component with SSR-safe lifecycle and props-based configuration, updates WordPress/Nuxt.js/Hugo/Jekyll integration documentation with copy-paste examples, refactors core container resolution with error handling, improves clipboard copy behavior in demo site to collect multiple code blocks, includes complete static demo pages for three frameworks, and normalizes formatting across source files.

Changes

Framework Integration Implementation and Documentation

Layer / File(s) Summary
Nuxt wrapper component
src/social-share-button-nuxt.vue
New SSR-safe Vue 3/Nuxt wrapper with comprehensive props (URL, title, description, platforms, theme, analytics, etc.), client-only initialization via polling for window.SocialShareButton, lifecycle cleanup via destroy(), and deep props watcher triggering updateOptions().
Core container resolution refactoring
src/social-share-button.js
Centralizes container lookup into _getContainer() with defensive try/catch, debug warnings on errors, and DOM Element validation (nodeType === 1); updates createButton() to conditionally append button only when resolver returns valid element; adds JSDoc for updateOptions() describing dynamic update behavior.
README framework support and integration overview
README.md
Expands "Features" list to include Nuxt.js, WordPress, Hugo, Jekyll; rewrites "Integration Overview" into 3-step format; adds WordPress, Nuxt.js, and Hugo/Jekyll integration sections with CDN snippets and initialization examples; updates Preact CDN reference to @v1.0.3.
Demo site integrations and clipboard behavior
index.html
Adds WordPress, Qwik/QwikCity, Nuxt.js, Hugo/Jekyll integration sections with updated CDN URLs (@v1.0.3) and deferred script tags; reworks clipboard copy handler to gather all code elements within .code-block, concatenate with newlines, and display success/failure messages with 2-second auto-reset.
Static demo pages
hugo-demo/index.html, hugo-demo/layouts/_default/baseof.html, jekyll-demo/index.html, wordpress-demo-project/index.html
Adds four complete demo HTML pages and a Hugo layout template demonstrating CDN-based integration with page metadata (runtime URL/title) and configuration options (theme, button style, text).
Source file formatting
src/social-share-button-preact.jsx, src/social-share-button-react.jsx, src/social-share-button.css, landing-page/src/app/globals.css
Normalizes JSDoc indentation, comment spacing, whitespace around effect hooks, and CSS rule formatting without changing logic, dependency arrays, or cleanup behavior.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant NuxtApp as Nuxt App Instance
    participant Browser as Browser (window, DOM)
    participant CDN as CDN (SocialShareButton script)
    participant VanillaLib as window.SocialShareButton

    NuxtApp->>Browser: onMounted (client-side only, SSR guarded)
    NuxtApp->>Browser: start polling for VanillaLib
    Browser->>CDN: script loaded (if not cached)
    CDN-->>Browser: window.SocialShareButton available
    NuxtApp->>VanillaLib: new SocialShareButton({ container, url, title, options })
    VanillaLib-->>Browser: render button DOM in container
    NuxtApp->>Browser: props change (url, title, platforms, etc)
    NuxtApp->>VanillaLib: updateOptions({ ...changed props })
    VanillaLib-->>Browser: update button state
    NuxtApp->>Browser: onBeforeUnmount
    NuxtApp->>VanillaLib: destroy()
    VanillaLib-->>Browser: cleanup DOM, remove listeners
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AOSSIE-Org/SocialShareButton#63 — Both PRs update README integration guidance and lifecycle/container documentation with 3-step setup and framework-specific initialization patterns.
  • AOSSIE-Org/SocialShareButton#75 — Both PRs expand index.html framework integration sections, including Qwik/QwikCity and updating CDN references to newer versions.
  • AOSSIE-Org/SocialShareButton#1 — The core src/social-share-button.js modifications in this PR (container resolution, _getContainer(), createButton()) build upon the initial implementation from that PR.

Suggested labels

Documentation, Typescript Lang

Suggested reviewers

  • kpj2006

Poem

🐰 A Nuxt wrapper hops with care,
SSR guards and props laid bare,
Hugo, Jekyll, WordPress unite,
Clipboard gathers every bite,
Safe containers, demos bright—
Share buttons dancing left and right!

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Several changes fall outside issue #51's scope: WordPress integration documentation and demo files, Nuxt.js support, CSS/whitespace normalization across multiple files, and updates to social-share-button.js logic for container resolution. Remove WordPress and Nuxt.js changes; consolidate into separate PRs. Consider whether container resolution refactoring in social-share-button.js should be in a distinct PR for proper isolation of concerns.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly summarizes the main change: adding Hugo and Jekyll integration guides and demo sections, which aligns directly with the primary objective of issue #51.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #51: Hugo and Jekyll integration via CDN-only approach, new demo sections in index.html with copy-to-clipboard functionality, README documentation updates, and demo project files for both frameworks.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size/XL Extra large PR (>500 lines changed) repeat-contributor PR from an external contributor who already had PRs merged needs-review labels Apr 20, 2026
@amankv1234

Copy link
Copy Markdown
Contributor Author

"Hi @kpj2006 ,
I've implemented the Hugo/Jekyll integration (#51) and fixed the CDN versioning. Please check my PR!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
index.html (2)

520-542: ⚠️ Potential issue | 🟡 Minor

CTA section is stranded in the middle of the integration docs.

cta-section now appears between Preact (ends L478) and the newly added Qwik/Nuxt/Next/Vue/Angular/Hugo-Jekyll sections (L542-721). The "Ready to Get Started?" call-to-action should be the last content block before the footer; users currently scroll past it and then see more integration docs, hurting the UX.

Move the cta-section block to just before </div> at line 722 (after the Hugo/Jekyll section).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@index.html` around lines 520 - 542, The CTA block with class "cta-section"
(the "Ready to Get Started?" call-to-action) is placed mid-doc between Preact
and the Qwik/Nuxt/Next/Vue/Angular/Hugo-Jekyll integration sections; move the
entire <div class="cta-section">...</div> block so it appears just before the
closing wrapper/div that ends the integrations (i.e., after the Hugo/Jekyll
section and immediately before the final </div>/footer), ensuring you preserve
its child anchor elements and attributes (class="cta-button" and
class="cta-button discord-btn") and keep target/rel attributes intact.

888-944: ⚠️ Potential issue | 🟡 Minor

Clipboard handler: minor hardening.

  • navigator.clipboard is undefined on non-secure contexts (HTTP / file://); the .writeText() call will throw TypeError synchronously before .then/.catch engages, leaving the button stuck on "Copy" with no feedback. Guard with if (!navigator.clipboard) { … fallback / status }.
  • On error you call setTimeout to reset to originalText while button.textContent is already originalText (line 928), making the delayed reset a no-op but still clearing the status span — acceptable, just note for clarity.
-            navigator.clipboard
-              .writeText(text)
+            if (!navigator.clipboard?.writeText) {
+              if (statusSpan?.classList.contains("copy-status")) {
+                statusSpan.textContent = "Clipboard API unavailable";
+              }
+              return;
+            }
+            navigator.clipboard
+              .writeText(text)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@index.html` around lines 888 - 944, The clipboard handler must guard against
navigator.clipboard being undefined; before calling
navigator.clipboard.writeText(...) in the click listener for copyButtons, check
if navigator.clipboard exists and handle the fallback by setting the statusSpan
(and button.textContent) to a clear failure message and scheduling/clearing
button.copyResetTimer as you do on catch, so the UI never becomes stuck if
writeText would throw synchronously; keep the existing success and catch flows
but move the initial presence check for navigator.clipboard to the top of the
listener and reuse the same reset logic (button.copyResetTimer) when the API is
missing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@index.html`:
- Around line 547-568: The copy button is concatenating multiple <code> elements
because the copy handler uses codeBlockContainer.querySelectorAll("code") and
joins them; fix by splitting the two snippets into separate .code-block
containers (each containing its own .copy-btn, .copy-status and a single <code>
node) so the existing copy button behavior remains consistent with other
sections; alternatively (if you prefer to keep one container) change the copy
logic that references codeBlockContainer.querySelectorAll("code") to only use
the first code element (e.g., querySelector("code")) — update the DOM structure
around the two snippets or the copy handler accordingly, referencing the
.code-block, .copy-btn, .copy-status elements and the
codeBlockContainer.querySelectorAll("code") usage.

In `@README.md`:
- Around line 625-640: The template-inserted description string in the
SocialShareButton init (the description property in the SocialShareButton
constructor) can break JS when page.description contains quotes, backslashes, or
newlines; change the Liquid/Jekyll insertion to emit a safe JSON string (use the
Liquid json/jsonify filter) and the Hugo insertion to use Hugo's jsonify (or
jsEscape) so the generated JS is valid JSON/JS string literal; update the same
pattern wherever SocialShareButton is initialized (the snippet that constructs
new SocialShareButton in README and in index.html).

In `@src/social-share-button-nuxt.vue`:
- Around line 1-86: Add a short header comment at the top of
src/social-share-button-nuxt.vue indicating this is a copy-paste wrapper
distributed manually (not yet on CDN) — mirror the pattern used in
social-share-button-react.jsx; place the comment above the <template> tag so
contributors see acquisition instructions immediately and mention that consumers
should copy this file into their project or use the released CDN/npm artifact
once the next release tag is cut.
- Around line 36-64: The component currently only tries to initialize inside
onMounted and silently does nothing if window.SocialShareButton isn't loaded;
add a polling fallback like in social-share-button-preact.jsx: inside onMounted
start a setInterval(100ms) that checks for window.SocialShareButton and a retry
counter (e.g., max retries), instantiate shareButton with the same options
(container, url, title, description, hashtags, via, platforms, theme,
buttonText, customClass, onShare, onCopy, buttonStyle, modalPosition,
buttonColor, buttonHoverColor, showButton, analytics, onAnalytics,
analyticsPlugins, componentId, debug) when found, then clearInterval; also save
the interval id and clear it in onBeforeUnmount (and also destroy/cleanup
shareButton if present) so the polling is bounded and cleaned up.
- Around line 74-85: Replace the direct watch(props, ...) with an explicit
getter watch(() => ({ ...props }), ...) to avoid receiving the same reactive
proxy for old/new values; inside the watcher keep the currentUrl/currentTitle
resolution and call shareButton.updateOptions({...}) as before. Also update the
updateOptions implementation (function name: updateOptions) or add
documentation: either make updateOptions trigger a full re-render when
non-reactive-affecting fields change (theme, buttonText, buttonStyle, platforms)
or clearly document that only url, buttonColor, and buttonHoverColor currently
take effect on update and other fields require re-creation of the shareButton
instance. Ensure references to shareButton and updateOptions are updated
accordingly.

In `@src/social-share-button.js`:
- Around line 694-699: The validation in _getContainer() uses "instanceof
Element" which can throw if the Element global is undefined; change the guard to
first check typeof Element !== "undefined" before using instanceof (e.g., only
evaluate container instanceof Element when Element exists), and keep the
existing fallback check container.nodeType === 1 so the function safely returns
null and warns when container is not a DOM element.

---

Outside diff comments:
In `@index.html`:
- Around line 520-542: The CTA block with class "cta-section" (the "Ready to Get
Started?" call-to-action) is placed mid-doc between Preact and the
Qwik/Nuxt/Next/Vue/Angular/Hugo-Jekyll integration sections; move the entire
<div class="cta-section">...</div> block so it appears just before the closing
wrapper/div that ends the integrations (i.e., after the Hugo/Jekyll section and
immediately before the final </div>/footer), ensuring you preserve its child
anchor elements and attributes (class="cta-button" and class="cta-button
discord-btn") and keep target/rel attributes intact.
- Around line 888-944: The clipboard handler must guard against
navigator.clipboard being undefined; before calling
navigator.clipboard.writeText(...) in the click listener for copyButtons, check
if navigator.clipboard exists and handle the fallback by setting the statusSpan
(and button.textContent) to a clear failure message and scheduling/clearing
button.copyResetTimer as you do on catch, so the UI never becomes stuck if
writeText would throw synchronously; keep the existing success and catch flows
but move the initial presence check for navigator.clipboard to the top of the
listener and reuse the same reset logic (button.copyResetTimer) when the API is
missing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 320df6ce-a9e0-4e41-928e-6021f30ff86c

📥 Commits

Reviewing files that changed from the base of the PR and between d0686c4 and e6a99a1.

📒 Files selected for processing (13)
  • CONTRIBUTING.md
  • README.md
  • docs/Roadmap.md
  • eslint.config.js
  • index.html
  • landing-page/README.md
  • landing-page/src/app/globals.css
  • src/social-share-analytics.js
  • src/social-share-button-nuxt.vue
  • src/social-share-button-preact.jsx
  • src/social-share-button-react.jsx
  • src/social-share-button.css
  • src/social-share-button.js

Comment thread index.html
Comment thread README.md
Comment thread src/social-share-button-nuxt.vue
Comment thread src/social-share-button-nuxt.vue
Comment thread src/social-share-button-nuxt.vue Outdated
Comment thread src/social-share-button.js
@kpj2006 kpj2006 removed the Stale label May 6, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hugo-demo/index.html`:
- Around line 8-11: Replace the forked feature-branch CDN references with the
canonical release tag so the demo won't break after the contributor branch is
removed: change the link href that currently points to
"amankv1234/SocialShareButton@feature/hugo-jekyll-demo-cdn-guide/.../social-share-button.css"
to use "AOSSIE-Org/SocialShareButton@v1.0.3/.../social-share-button.css", and
likewise update the script src that loads the JS from the same fork to
"AOSSIE-Org/SocialShareButton@v1.0.3/.../social-share-button.js" so both the CSS
link and the JS script tags reference the stable v1.0.3 package instead of the
contributor fork.

In `@hugo-demo/layouts/_default/baseof.html`:
- Around line 8-11: The CDN URL in the <link> tag
(href="https://cdn.jsdelivr.net/gh/amankv1234/SocialShareButton@feature/hugo-jekyll-demo-cdn-guide/...")
is pointing to a fork/branch; update all occurrences in
layouts/_default/baseof.html (the <link> stylesheet reference and the other URL
around the social share button include) to the canonical release URL by
replacing "amankv1234/SocialShareButton@feature/hugo-jekyll-demo-cdn-guide" with
"AOSSIE-Org/SocialShareButton@v1.0.3" so both hrefs (the stylesheet at the top
and the other reference near lines 55–59) use the AOSSIE-Org v1.0.3 CDN path.

In `@index.html`:
- Around line 919-952: The code calls navigator.clipboard.writeText without
guarding for navigator.clipboard being undefined; update the copy handler (same
logic as copyLink in src/social-share-button.js) to first check if navigator &&
navigator.clipboard, and if not immediately set button.textContent and
statusSpan to the failure text and start the copyResetTimer to restore
originalText; otherwise call
navigator.clipboard.writeText(text).then(...).catch(...) as before—this prevents
a synchronous TypeError on non-HTTPS or older browsers and ensures the button
always resets.

In `@jekyll-demo/index.html`:
- Around line 8-11: Update the CDN URLs that point to the forked branch: find
occurrences of the string
"amankv1234/SocialShareButton@feature/hugo-jekyll-demo-cdn-guide" in
jekyll-demo/index.html (used in the link href for social-share-button.css and
the script src for social-share-button.js) and replace them with
"AOSSIE-Org/SocialShareButton@v1.0.3", ensuring the CSS uses
social-share-button.css and the JS uses social-share-button.js (i.e., change the
href to
https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.css
and the script src to
https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.js
for both occurrences).

In `@wordpress-demo-project/index.html`:
- Around line 8-11: Replace the fork/branch CDN URLs that reference
amankv1234/SocialShareButton@feature/... with the official release CDN links:
update the href for social-share-button.css and the script src for
social-share-button.js to use
https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.css
and
https://cdn.jsdelivr.net/gh/AOSSIE-Org/SocialShareButton@v1.0.3/src/social-share-button.js
respectively; locate the link element that loads social-share-button.css and the
script element that loads social-share-button.js and swap their href/src values
to the new AOSSIE-Org v1.0.3 URLs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7a035477-726d-43d7-889c-da4074b8947a

📥 Commits

Reviewing files that changed from the base of the PR and between e6a99a1 and 3912804.

📒 Files selected for processing (8)
  • README.md
  • hugo-demo/index.html
  • hugo-demo/layouts/_default/baseof.html
  • index.html
  • jekyll-demo/index.html
  • src/social-share-button-nuxt.vue
  • src/social-share-button.js
  • wordpress-demo-project/index.html

Comment thread hugo-demo/index.html Outdated
Comment thread hugo-demo/layouts/_default/baseof.html Outdated
Comment thread index.html
Comment thread jekyll-demo/index.html Outdated
Comment thread wordpress-demo-project/index.html
@amankv1234

Copy link
Copy Markdown
Contributor Author

🎥 Integration Demo Video

I have recorded a comprehensive demo showcasing the seamless integration of SocialShareButton with Hugo, Jekyll, and WordPress.

Video Link: https://drive.google.com/file/d/1b3OF0z5Hw7txLqPdSkMsAlLAGbClWjeg/view?usp=sharing

What's covered in the video:

  • Frameworks: Hugo, Jekyll, and WordPress integration.
  • Code Setup: Demonstrated the use of branch-specific CDN links for testing.
  • Integration Guide: Verified the new README sections for these frameworks.
  • Functionality:
    • Modal rendering on localhost.
    • Social platform sharing (WhatsApp, X).
    • "Copy Link" functionality with feedback.
  • Console: Verified zero errors during all interactions.

CDN used for demo:

  • CSS: https://cdn.jsdelivr.net/gh/amankv1234/SocialShareButton@feature/hugo-jekyll-demo-cdn-guide/src/social-share-button.css
  • JS: https://cdn.jsdelivr.net/gh/amankv1234/SocialShareButton@feature/hugo-jekyll-demo-cdn-guide/src/social-share-button.js

@amankv1234

Copy link
Copy Markdown
Contributor Author

Hello @kpj2006,

I have completed the Hugo, Jekyll, and WordPress integrations as requested in PR #151.

Updates:

  1. Added dedicated integration guides and demo snippets for Hugo, Jekyll, and WordPress.
  2. Verified all features (Modal, Sharing, Copy Link) on local demo projects.
  3. Uploaded the integration demo video (link provided above).
  4. Ensured all code is formatted and CDN links are updated to @v1.0.3.

Please review the changes and the demo video. Let me know if there is anything else I should do or if any further improvements are needed.

Thank you!

@github-actions

Copy link
Copy Markdown

⚠️ This PR has merge conflicts.

Please resolve the merge conflicts before review.

Your PR will only be reviewed by a maintainer after all conflicts have been resolved.

📺 Watch this video to understand why conflicts occur and how to resolve them:
https://www.youtube.com/watch?v=Sqsz1-o7nXk

@amankv1234

Copy link
Copy Markdown
Contributor Author

Hi @kpj2006 ,

I have resolved all the conflicts in my PR. Could you please review and merge it when you get a chance? I’m eager to continue contributing to the project and work on further tasks.

Thank you!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (1)
index.html (1)

919-952: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard Clipboard API before calling writeText to avoid sync runtime failure.

navigator.clipboard.writeText(...) is invoked without checking API availability. In unsupported/insecure contexts this throws before .catch(...), so copy UI may not recover.

Suggested minimal fix
-            navigator.clipboard
-              .writeText(text)
+            if (!navigator.clipboard || !navigator.clipboard.writeText) {
+              button.textContent = originalText;
+              if (statusSpan && statusSpan.classList.contains("copy-status")) {
+                statusSpan.textContent = "Failed to copy to clipboard";
+              }
+              button.copyResetTimer = setTimeout(() => {
+                button.textContent = originalText;
+                if (statusSpan && statusSpan.classList.contains("copy-status")) {
+                  statusSpan.textContent = "";
+                }
+              }, 2000);
+              return;
+            }
+
+            navigator.clipboard
+              .writeText(text)
               .then(() => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@index.html` around lines 919 - 952, The code calls
navigator.clipboard.writeText() without first verifying that the clipboard API
is available, which can cause a synchronous runtime error in unsupported or
insecure contexts before the promise chain is established, preventing the catch
handler from executing. Add a guard check before invoking
navigator.clipboard.writeText() to verify that navigator.clipboard and the
writeText method exist. If the clipboard API is unavailable, handle the failure
by setting button.textContent to originalText, updating the statusSpan if
present to show "Failed to copy to clipboard", and setting the copyResetTimer to
reset the UI after 2000ms, similar to the existing catch handler logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/social-share-button-preact.jsx`:
- Line 18: The platforms array in the Preact component is missing "pinterest"
compared to the vanilla library defaults and React wrapper implementation. Add
"pinterest" to the platforms array in the Preact social share button component
to include all eight platforms and maintain consistency across the vanilla,
React, and Preact wrapper implementations. This ensures users of the Preact
wrapper have the same platform options available as the other wrapper versions.
- Around line 139-142: The inline comment explaining the purpose of
JSON.stringify() on the hashtags and platforms variables needs to be clearer
about the underlying intent. Replace the current comment that says "prevent
unnecessary re-runs when parent components pass fresh array literals on every
render" with a more explicit explanation that JSON.stringify() is being used as
a shallow-equality workaround to stabilize dependency references and prevent
unnecessary effect re-runs. This should make it immediately clear to readers
that the stringification is a pattern to work around JavaScript object/array
reference equality issues in dependency arrays.

In `@src/social-share-button.js`:
- Around line 418-421: The `copyLink()` method call in the Discord platform
handling path assumes `this.modal` exists, but it may be null if
`share("discord")` is called before initialization or after component
destruction. Guard the `copyLink()` invocation by checking if `this.modal`
exists before calling it, or implement the clipboard copy logic directly using
`this.options.url` without modal dependency to keep the Discord share path
non-fatal like other platforms.

---

Duplicate comments:
In `@index.html`:
- Around line 919-952: The code calls navigator.clipboard.writeText() without
first verifying that the clipboard API is available, which can cause a
synchronous runtime error in unsupported or insecure contexts before the promise
chain is established, preventing the catch handler from executing. Add a guard
check before invoking navigator.clipboard.writeText() to verify that
navigator.clipboard and the writeText method exist. If the clipboard API is
unavailable, handle the failure by setting button.textContent to originalText,
updating the statusSpan if present to show "Failed to copy to clipboard", and
setting the copyResetTimer to reset the UI after 2000ms, similar to the existing
catch handler logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 530552de-6e9b-41c2-b061-fc7df424796e

📥 Commits

Reviewing files that changed from the base of the PR and between 3912804 and f9f00a4.

📒 Files selected for processing (5)
  • README.md
  • index.html
  • src/social-share-button-preact.jsx
  • src/social-share-button-react.jsx
  • src/social-share-button.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

♻️ Duplicate comments (1)
index.html (1)

919-952: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard Clipboard API before calling writeText to avoid sync runtime failure.

navigator.clipboard.writeText(...) is invoked without checking API availability. In unsupported/insecure contexts this throws before .catch(...), so copy UI may not recover.

Suggested minimal fix
-            navigator.clipboard
-              .writeText(text)
+            if (!navigator.clipboard || !navigator.clipboard.writeText) {
+              button.textContent = originalText;
+              if (statusSpan && statusSpan.classList.contains("copy-status")) {
+                statusSpan.textContent = "Failed to copy to clipboard";
+              }
+              button.copyResetTimer = setTimeout(() => {
+                button.textContent = originalText;
+                if (statusSpan && statusSpan.classList.contains("copy-status")) {
+                  statusSpan.textContent = "";
+                }
+              }, 2000);
+              return;
+            }
+
+            navigator.clipboard
+              .writeText(text)
               .then(() => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@index.html` around lines 919 - 952, The code calls
navigator.clipboard.writeText() without first verifying that the clipboard API
is available, which can cause a synchronous runtime error in unsupported or
insecure contexts before the promise chain is established, preventing the catch
handler from executing. Add a guard check before invoking
navigator.clipboard.writeText() to verify that navigator.clipboard and the
writeText method exist. If the clipboard API is unavailable, handle the failure
by setting button.textContent to originalText, updating the statusSpan if
present to show "Failed to copy to clipboard", and setting the copyResetTimer to
reset the UI after 2000ms, similar to the existing catch handler logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/social-share-button-preact.jsx`:
- Line 18: The platforms array in the Preact component is missing "pinterest"
compared to the vanilla library defaults and React wrapper implementation. Add
"pinterest" to the platforms array in the Preact social share button component
to include all eight platforms and maintain consistency across the vanilla,
React, and Preact wrapper implementations. This ensures users of the Preact
wrapper have the same platform options available as the other wrapper versions.
- Around line 139-142: The inline comment explaining the purpose of
JSON.stringify() on the hashtags and platforms variables needs to be clearer
about the underlying intent. Replace the current comment that says "prevent
unnecessary re-runs when parent components pass fresh array literals on every
render" with a more explicit explanation that JSON.stringify() is being used as
a shallow-equality workaround to stabilize dependency references and prevent
unnecessary effect re-runs. This should make it immediately clear to readers
that the stringification is a pattern to work around JavaScript object/array
reference equality issues in dependency arrays.

In `@src/social-share-button.js`:
- Around line 418-421: The `copyLink()` method call in the Discord platform
handling path assumes `this.modal` exists, but it may be null if
`share("discord")` is called before initialization or after component
destruction. Guard the `copyLink()` invocation by checking if `this.modal`
exists before calling it, or implement the clipboard copy logic directly using
`this.options.url` without modal dependency to keep the Discord share path
non-fatal like other platforms.

---

Duplicate comments:
In `@index.html`:
- Around line 919-952: The code calls navigator.clipboard.writeText() without
first verifying that the clipboard API is available, which can cause a
synchronous runtime error in unsupported or insecure contexts before the promise
chain is established, preventing the catch handler from executing. Add a guard
check before invoking navigator.clipboard.writeText() to verify that
navigator.clipboard and the writeText method exist. If the clipboard API is
unavailable, handle the failure by setting button.textContent to originalText,
updating the statusSpan if present to show "Failed to copy to clipboard", and
setting the copyResetTimer to reset the UI after 2000ms, similar to the existing
catch handler logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 530552de-6e9b-41c2-b061-fc7df424796e

📥 Commits

Reviewing files that changed from the base of the PR and between 3912804 and f9f00a4.

📒 Files selected for processing (5)
  • README.md
  • index.html
  • src/social-share-button-preact.jsx
  • src/social-share-button-react.jsx
  • src/social-share-button.js
🛑 Comments failed to post (3)
src/social-share-button-preact.jsx (2)

18-18: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Platform array diverges from vanilla library defaults and React wrapper.

Line 18 specifies ["whatsapp", "facebook", "twitter", "linkedin", "telegram", "reddit", "discord"], which omits "pinterest". The vanilla library defaults (src/social-share-button.js:19-28) include "pinterest", and the React wrapper (src/social-share-button-react.jsx:16) includes all eight platforms. This inconsistency could lead to unexpected behavior differences between the two wrapper implementations.

Verify whether this omission is intentional; if not, add "pinterest" to maintain parity with the vanilla library and React version.

Proposed fix to add "pinterest" to match vanilla library defaults
-  platforms = ["whatsapp", "facebook", "twitter", "linkedin", "telegram", "reddit", "discord"],
+  platforms = ["whatsapp", "facebook", "twitter", "linkedin", "telegram", "reddit", "pinterest", "discord"],
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/social-share-button-preact.jsx` at line 18, The platforms array in the
Preact component is missing "pinterest" compared to the vanilla library defaults
and React wrapper implementation. Add "pinterest" to the platforms array in the
Preact social share button component to include all eight platforms and maintain
consistency across the vanilla, React, and Preact wrapper implementations. This
ensures users of the Preact wrapper have the same platform options available as
the other wrapper versions.

139-142: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Comment improvement: clarify the intent of array dependency stringification.

The inline comment at lines 139–140 could be more precise. Currently it says "prevent unnecessary re-runs when parent components pass fresh array literals on every render." Consider making it even clearer that JSON.stringify() is used as a shallow-equality workaround to stabilize dependency references.

Optional clarification for the comment
-  // Stringify array dependencies to prevent unnecessary re-runs when 
-  // parent components pass fresh array literals on every render.
+  // Stringify array/object dependencies to prevent unnecessary re-runs 
+  // due to fresh reference identity from parent components every render.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  // Stringify array/object dependencies to prevent unnecessary re-runs 
  // due to fresh reference identity from parent components every render.
  const hashtagsDep = JSON.stringify(hashtags);
  const platformsDep = JSON.stringify(platforms);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/social-share-button-preact.jsx` around lines 139 - 142, The inline
comment explaining the purpose of JSON.stringify() on the hashtags and platforms
variables needs to be clearer about the underlying intent. Replace the current
comment that says "prevent unnecessary re-runs when parent components pass fresh
array literals on every render" with a more explicit explanation that
JSON.stringify() is being used as a shallow-equality workaround to stabilize
dependency references and prevent unnecessary effect re-runs. This should make
it immediately clear to readers that the stringification is a pattern to work
around JavaScript object/array reference equality issues in dependency arrays.

Source: Coding guidelines

src/social-share-button.js (1)

418-421: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Guard copyLink() usage in Discord share path to avoid null-modal crashes.

On Line 419, this.copyLink() assumes this.modal exists. If consumers call share("discord") programmatically before init/after destroy, this can throw via this.modal.querySelector(...). Keep Discord share non-fatal like other platforms by gating clipboard UI logic behind modal existence (or copying directly from this.options.url without modal dependency).

Proposed fix
       if (platform === "discord") {
-        this.copyLink();
+        if (this.modal) {
+          this.copyLink();
+        } else if (navigator.clipboard?.writeText) {
+          navigator.clipboard.writeText(this.options.url).catch(() => {});
+        }
         window.open(shareUrl, "_blank", "noopener,noreferrer");
       } else if (platform === "email") {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/social-share-button.js` around lines 418 - 421, The `copyLink()` method
call in the Discord platform handling path assumes `this.modal` exists, but it
may be null if `share("discord")` is called before initialization or after
component destruction. Guard the `copyLink()` invocation by checking if
`this.modal` exists before calling it, or implement the clipboard copy logic
directly using `this.options.url` without modal dependency to keep the Discord
share path non-fatal like other platforms.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
index.html (1)

933-965: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: .writeText(text) call is missing — synchronous TypeError on every copy button click.

Line 933 calls .then() directly on the navigator.clipboard object instead of on the promise returned by writeText(text). This will throw TypeError: navigator.clipboard.then is not a function synchronously, breaking all copy functionality and contradicting the PR's claim of zero console errors.

🔧 Proposed fix
-            navigator.clipboard
+            navigator.clipboard.writeText(text)
               .then(() => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@index.html` around lines 933 - 965, The navigator.clipboard object is being
used directly with `.then()` instead of calling the writeText method first. To
fix this, insert `.writeText(text)` immediately after `navigator.clipboard` so
that the promise chain is called on the result of the writeText method rather
than on the navigator.clipboard object itself. This will ensure the
copy-to-clipboard operation is properly executed before the success or failure
handlers are triggered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@index.html`:
- Around line 933-965: The navigator.clipboard object is being used directly
with `.then()` instead of calling the writeText method first. To fix this,
insert `.writeText(text)` immediately after `navigator.clipboard` so that the
promise chain is called on the result of the writeText method rather than on the
navigator.clipboard object itself. This will ensure the copy-to-clipboard
operation is properly executed before the success or failure handlers are
triggered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 72d8279d-a84f-4526-8931-790050564a36

📥 Commits

Reviewing files that changed from the base of the PR and between f9f00a4 and 988a312.

📒 Files selected for processing (1)
  • index.html

@github-actions

Copy link
Copy Markdown

⚠️ This PR has merge conflicts.

Please resolve the merge conflicts before review.

Your PR will only be reviewed by a maintainer after all conflicts have been resolved.

📺 Watch this video to understand why conflicts occur and how to resolve them:
https://www.youtube.com/watch?v=Sqsz1-o7nXk

@kpj2006 kpj2006 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no need to push jekyll-demo and wordpress-demo-project folder.

@amankv1234

Copy link
Copy Markdown
Contributor Author

jekyll-demo and wordpress-demo-project folder

@kpj2006 , I removed jekyll-demo and wordpress-demo-project folder as you mention

@github-actions

Copy link
Copy Markdown

⚠️ This PR has merge conflicts.

Please resolve the merge conflicts before review.

Your PR will only be reviewed by a maintainer after all conflicts have been resolved.

📺 Watch this video to understand why conflicts occur and how to resolve them:
https://www.youtube.com/watch?v=Sqsz1-o7nXk

@github-actions github-actions Bot removed PR has merge conflicts configuration Configuration file changes labels Jun 26, 2026
@amankv1234 amankv1234 requested a review from kpj2006 June 26, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Changes to documentation files frontend Changes to frontend code javascript JavaScript/TypeScript code changes needs-review planned Planned feature - not final, may be dropped based on repo direction repeat-contributor PR from an external contributor who already had PRs merged size/XL Extra large PR (>500 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Add Hugo / Jekyll Integration — demo page section and CDN usage guide

2 participants