Skip to content

Enhancement: Add Server-Rendered Framework Integration (Rails / Django / Laravel) β€” demo page section and CDN usage guideΒ #53

@coderabbitai

Description

@coderabbitai

🎯 Direction

SocialShareButton is a lightweight, zero-dependency, framework-agnostic social sharing component. Ruby on Rails, Django, and Laravel are the three most popular server-rendered web frameworks β€” they generate HTML on the server and send it to the browser, making CDN-based widget integration the standard approach. This issue adds a single combined demo section covering all three, since the integration pattern is near-identical across them.

πŸ“Ή See the button in action: https://youtu.be/cLJaT-8rEvQ?si=CLipA0Db4WL0EqKM


πŸ“ Files to Create / Modify

ℹ️ No New Wrapper File Needed

Integration is done by placing CDN <link> and <script> tags in the server-rendered base layout template of each framework. No JavaScript wrapper is required.


βœ… Existing File: index.html β€” Add Server-Rendered Frameworks Section

Add a new section with:

  • Section heading: πŸ–₯️ Server-Rendered Frameworks (Rails / Django / Laravel)
  • A brief note that the pattern is the same across all three β€” include CSS in <head>, JS before </body>, initialize with a script

Ruby on Rails (app/views/layouts/application.html.erb):

<%# In <head> %>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.css">

<%# Before </body> %>
<script src="https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.js"></script>
<div id="share-button"></div>
<script>
  new SocialShareButton({
    container: '#share-button',
    url: window.location.href,
    title: document.title,
    theme: 'dark',
    buttonText: 'Share'
  });
</script>

Django (templates/base.html):

{# In <head> #}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.css">

{# Before </body> #}
<script src="https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.js"></script>
<div id="share-button"></div>
<script>
  new SocialShareButton({
    container: '#share-button',
    url: window.location.href,
    title: document.title,
    theme: 'dark',
    buttonText: 'Share'
  });
</script>

Laravel (resources/views/layouts/app.blade.php):

{{-- In <head> --}}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.css">

{{-- Before </body> --}}
<script src="https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.js"></script>
<div id="share-button"></div>
<script>
  new SocialShareButton({
    container: '#share-button',
    url: window.location.href,
    title: document.title,
    theme: 'dark',
    buttonText: 'Share'
  });
</script>

βœ… Acceptance Criteria

  • No new wrapper file required β€” integration is template/CDN only
  • index.html updated with a server-rendered frameworks section containing separate code snippets for Rails, Django, and Laravel
  • Copy-to-clipboard button present on new code blocks in index.html
  • README updated to mention Rails, Django, and Laravel as supported integration patterns

⚠️ Planned β€” Not Final
This issue represents a planned enhancement and is not guaranteed to be implemented. It may be dropped if it does not align with the repository's direction. Before opening a pull request, please discuss with the maintainers in this issue thread.

Metadata

Metadata

Labels

plannedPlanned feature - not final, may be dropped based on repo direction

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions