-
-
-
- Optional: Used as a fallback if the preview image can't be used by the browser.
- For example using a jpg or png as fallback for avif which is not supported in Safari or Edge.
-
-
-
-
- model.IsPublished &= !IsScheduled)" />
-
-
- If set the blog post will be published at the given date.
- A blog post with a schedule date can't be set to published.
-
-
-
-
-
-
- If this blog post is only draft or it will be scheduled, uncheck the box.
-
-
-
-
-
-
- @if (BlogPost is not null && !IsScheduled)
- {
-
-
-
-
- If set the publish date is set to now,
- otherwise its original date.
-
-
- }
-
-
-
- The first page of the blog is cached. Therefore, the blog post is not immediately visible.
- Head over to settings to invalidate the cache or enable the checkmark.
-
- The option should be enabled if you want to publish the blog post immediately and it should be visible on the first page.
-
-
-
-
-
-
-
+
+
+
+
+
+
+ The primary image which will be used.
+
+
+
+
+
+ Optional: Used as a fallback if the preview image can't be used by the browser.
+ For example using a jpg or png as fallback for avif which is not supported in Safari or Edge.
+
+
+
+ model.IsPublished &= !IsScheduled)"/>
+
+ If set the blog post will be published at the given date.
+ A blog post with a schedule date can't be set to published.
+
+
+
+
+
+ If this blog post is only draft or it will be scheduled, uncheck the box.
+
+
+
+
+
+
+
+
+
+ The blog post can only be read by members.
+
+ @if (BlogPost is not null && !IsScheduled)
+ {
+
+
+
+ If set the publish date is set to now,
+ otherwise its original date.
+
+ }
+
+
+
+ The first page of the blog is cached. Therefore, the blog post is not immediately visible.
+ Head over to settings to invalidate the cache or enable the checkmark.
+
+ The option should be enabled if you want to publish the blog post immediately and it should be visible on the first page.
+
+
+
+
+
+
+
diff --git a/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs b/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs
index 6c7c5153..6e92ca9c 100644
--- a/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs
+++ b/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/Components/CreateNewModel.cs
@@ -18,6 +18,7 @@ public sealed class CreateNewModel
private string tags = string.Empty;
private string previewImageUrlFallback = string.Empty;
private DateTime? scheduledPublishDate;
+ private bool isMembersOnly;
[Required]
[MaxLength(256)]
@@ -64,6 +65,12 @@ public bool ShouldUpdateDate
set => SetProperty(out shouldUpdateDate, value);
}
+ public bool IsMembersOnly
+ {
+ get => isMembersOnly;
+ set => SetProperty(out isMembersOnly, value);
+ }
+
[FutureDateValidation]
public DateTime? ScheduledPublishDate
{
@@ -128,6 +135,7 @@ public BlogPost ToBlogPost()
Content,
PreviewImageUrl,
IsPublished,
+ IsMembersOnly,
updatedDate,
scheduledPublishDate,
tagList,
diff --git a/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/CreateBlogPost.razor b/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/CreateBlogPost.razor
index 26e190b4..6728c76a 100644
--- a/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/CreateBlogPost.razor
+++ b/src/LinkDotNet.Blog.Web/Features/Admin/BlogPostEditor/CreateBlogPost.razor
@@ -1,5 +1,5 @@
@page "/create"
-@attribute [Authorize]
+@attribute [Authorize(Roles = "Admin")]
@using LinkDotNet.Blog.Domain
@using LinkDotNet.Blog.Infrastructure.Persistence
@using LinkDotNet.Blog.Web.Features.Admin.BlogPostEditor.Components
diff --git a/src/LinkDotNet.Blog.Web/Features/Admin/Sitemap/SitemapPage.razor b/src/LinkDotNet.Blog.Web/Features/Admin/Sitemap/SitemapPage.razor
index 2304b0b7..9f2bcd52 100644
--- a/src/LinkDotNet.Blog.Web/Features/Admin/Sitemap/SitemapPage.razor
+++ b/src/LinkDotNet.Blog.Web/Features/Admin/Sitemap/SitemapPage.razor
@@ -1,7 +1,7 @@
@page "/Sitemap"
@using LinkDotNet.Blog.Web.Features.Admin.Sitemap.Services
@inject ISitemapService SitemapService
-@attribute [Authorize]
+@attribute [Authorize(Roles = "Admin")]
Sitemap
@@ -14,12 +14,12 @@
If you get a 404 there is currently no sitemap.xml
- @if (isGenerating)
- {
-
- }
- @if (sitemapUrlSet is not null)
- {
+ @if (isGenerating)
+ {
+
+ }
+ @if (sitemapUrlSet is not null)
+ {