Skip to content

Commit

Permalink
add twitter share button
Browse files Browse the repository at this point in the history
  • Loading branch information
EdiWang committed Oct 9, 2023
1 parent 07cbd47 commit 386911f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions src/Moonglade.Web/Pages/_PostActions.cshtml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
@model Moonglade.Core.PostFeature.Post
@inject IConfiguration Configuration

<hr />
<div class="post-slug-actions clearfix mb-2 d-print-none">
@if (null == ViewBag.IsDraftPreview)
{
<div class="float-end">
<a href="javascript:;" class="text-muted d-inline-block" data-bs-toggle="modal" data-bs-target="#qrcode-window" title="Link to show QR Code for this blog post">
<i class="bi-qr-code-scan"></i>
</a>
</div>
}
<div>
<div class="row g-1 align-items-center post-slug-actions clearfix mb-2 d-print-none">
<div class="col-md">
<section class="post-cat-tag-info">
<ul class="d-flex flex-row flex-wrap list-unstyled ul-cat-list-desktop mb-0">
@foreach (var item in Model.Categories)
Expand Down Expand Up @@ -41,6 +34,23 @@
</ul>
</section>
</div>
@if (null == ViewBag.IsDraftPreview)
{
<div class="col-auto">
@if (bool.Parse(Configuration["Experimental:ShowTwitterShareButton"]!))
{
<div class="twitter-share-container mt-1 me-2">
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-show-count="false">Tweet</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
}
</div>
<div class="col-auto">
<a href="javascript:;" class="text-muted" data-bs-toggle="modal" data-bs-target="#qrcode-window" title="Link to show QR Code for this blog post">
<i class="bi-qr-code-scan"></i>
</a>
</div>
}
</div>

<partial name="_QRCodeWindow" />
2 changes: 1 addition & 1 deletion src/Moonglade.Web/web.Release.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<add name="x-content-type-options" value="nosniff" />
<add name="x-xss-protection" value="1" />
<add name="content-security-policy"
value="frame-ancestors 'self'; form-action 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com https://*.vo.msecnd.net https://*.services.visualstudio.com https://*.monitor.azure.com; worker-src blob: data: https://cdnjs.cloudflare.com"/>
value="frame-ancestors 'self'; form-action 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com https://*.vo.msecnd.net https://*.services.visualstudio.com https://*.monitor.azure.com https://twitter.com https://*.twitter.com; worker-src blob: data: https://cdnjs.cloudflare.com"/>
</customHeaders>
</httpProtocol>
<rewrite xdt:Transform="InsertIfMissing">
Expand Down

0 comments on commit 386911f

Please sign in to comment.