feat: enhance sharing options by adding Reddit and updating Twitter share label
This commit is contained in:
1 parent
d448574ff8
commit
dceae7a2ec
3 files changed
+12
-4
No files matched your search
@@ -8,9 +8,14 @@
|
||||
// Email account settings). Leave it to auto-detect, or hard-set $blowditEmail
|
||||
// below to override. Empty -> the icon is hidden.
|
||||
$blowditEmail = '';
|
||||
if (isset($site) && method_exists($site, 'getField')) {
|
||||
$blowditEmail = $site->getField('emailFromAddress'); // Bludit's "Sender email"
|
||||
if (empty($blowditEmail)) { $blowditEmail = $site->getField('email'); }
|
||||
if (isset($site)) {
|
||||
// Bludit's accessor is getValue(); fall back to getField() just in case.
|
||||
$bdGet = method_exists($site, 'getValue') ? 'getValue'
|
||||
: (method_exists($site, 'getField') ? 'getField' : null);
|
||||
if ($bdGet) {
|
||||
$blowditEmail = $site->$bdGet('emailFromAddress'); // Bludit's "Sender email"
|
||||
if (empty($blowditEmail)) { $blowditEmail = $site->$bdGet('email'); }
|
||||
}
|
||||
}
|
||||
// $blowditEmail = 'you@example.com'; // <- uncomment to set manually
|
||||
$blowditTwitterHandle = '@spleenftw'; // twitter:site / twitter:creator; '' to omit
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
"Email": "Email",
|
||||
"Share": "Share",
|
||||
"Share on X": "Share on X",
|
||||
"Share on X (Twitter)": "Share on X (Twitter)",
|
||||
"Share on Reddit": "Share on Reddit",
|
||||
"Share on LinkedIn": "Share on LinkedIn",
|
||||
"Copy link": "Copy link",
|
||||
"Link copied": "Link copied",
|
||||
|
||||
+2
-1
@@ -70,7 +70,8 @@
|
||||
<?php $bdShareUrl = $page->permalink(true); $bdShareTitle = blowdit_plain($page->title()); ?>
|
||||
<div class="post-share mt-4">
|
||||
<span class="post-share-label"><?php echo $L->get('Share'); ?></span>
|
||||
<a class="post-share-btn" href="https://twitter.com/intent/tweet?url=<?php echo rawurlencode($bdShareUrl); ?>&text=<?php echo rawurlencode($bdShareTitle); ?>" target="_blank" rel="noopener" aria-label="<?php echo $L->get('Share on X'); ?>">X</a>
|
||||
<a class="post-share-btn" href="https://twitter.com/intent/tweet?url=<?php echo rawurlencode($bdShareUrl); ?>&text=<?php echo rawurlencode($bdShareTitle); ?>" target="_blank" rel="noopener" aria-label="<?php echo $L->get('Share on X (Twitter)'); ?>">X (Twitter)</a>
|
||||
<a class="post-share-btn" href="https://www.reddit.com/submit?url=<?php echo rawurlencode($bdShareUrl); ?>&title=<?php echo rawurlencode($bdShareTitle); ?>" target="_blank" rel="noopener" aria-label="<?php echo $L->get('Share on Reddit'); ?>">Reddit</a>
|
||||
<a class="post-share-btn" href="https://www.linkedin.com/sharing/share-offsite/?url=<?php echo rawurlencode($bdShareUrl); ?>" target="_blank" rel="noopener" aria-label="<?php echo $L->get('Share on LinkedIn'); ?>">LinkedIn</a>
|
||||
<button type="button" class="post-share-btn js-copy-link" data-url="<?php echo htmlspecialchars($bdShareUrl, ENT_QUOTES, 'UTF-8'); ?>" aria-label="<?php echo $L->get('Copy link'); ?>"><?php echo blowdit_icon('link'); ?><span class="post-share-copy-label"><?php echo $L->get('Copy link'); ?></span></button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user