-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from sumitkumar9128/add-social-sharing-feature
Added social media sharing functionality for blog posts
- Loading branch information
Showing
9 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
console.log('Social media share buttons ready!'); | ||
// Add any future JS code for handling sharing events here | ||
// basically if want to expand in future | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
</main> | ||
<%- include('../partials/footer.ejs') %> | ||
</div> | ||
<script src="/js/share.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class="share-buttons"> | ||
<!-- Facebook Share Button --> | ||
<a href="https://www.facebook.com/sharer/sharer.php?u=<%= encodeURIComponent(currentUrl) %>" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
class="share-button facebook"> | ||
<img src="/img/facebook.svg" alt="Share on Facebook" /> | ||
</a> | ||
|
||
<!-- Twitter Share Button --> | ||
<a href="https://twitter.com/intent/tweet?text=<%= encodeURIComponent(locals.title) %>&url=<%= encodeURIComponent(currentUrl) %>" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
class="share-button twitter"> | ||
<img src="/img/twitter.svg" alt="Share on Twitter" /> | ||
</a> | ||
|
||
<!-- LinkedIn Share Button --> | ||
<a href="https://www.linkedin.com/shareArticle?mini=true&url=<%= encodeURIComponent(currentUrl) %>&title=<%= encodeURIComponent(locals.title) %>" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
class="share-button linkedin"> | ||
<img src="/img/linkedin.svg" alt="Share on LinkedIn" /> | ||
</a> | ||
|
||
<!-- WhatsApp Share Button --> | ||
<a href="https://api.whatsapp.com/send?text=<%= encodeURIComponent(locals.title + ' ' + currentUrl) %>" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
class="share-button whatsapp"> | ||
<img src="/img/whatsapp.svg" alt="Share on WhatsApp" /> | ||
</a> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
<h1><%= locals.title %></h1> | ||
<p>By: <%= authorName %></p> <!-- Displaying the author's username --> | ||
<article class="article"><%= data.body %></article> | ||
|
||
<!-- Social Media Sharing Section --> | ||
<div class="share-section"> | ||
<h3>Share this post:</h3> | ||
<!-- Include the share-buttons partial --> | ||
<%- include('partials/share-buttons') %> | ||
</div> |