File tree Expand file tree Collapse file tree 4 files changed +21
-15
lines changed
src/LinkDotNet.Blog.Web/Features
tests/LinkDotNet.Blog.UnitTests/Web/Features/ShowBlogPost/Components Expand file tree Collapse file tree 4 files changed +21
-15
lines changed Original file line number Diff line number Diff line change 3
3
<HeadContent >
4
4
<meta name =" title" property =" og:title" content =" @Title" />
5
5
<link rel =" canonical" href =" @GetCanoncialUri()" />
6
- @if (AbsolutePreviewImageUrl != null )
6
+ @if (AbsolutePreviewImageUrl is not null )
7
7
{
8
8
<meta name =" image" property =" og:image" content =" @AbsolutePreviewImageUrl" />
9
9
}
10
10
<meta property =" og:type" content =" article" />
11
11
<meta property =" og:url" content =" @NavigationManager.Uri" />
12
- @if (Keywords != null )
12
+ @if (Keywords is not null )
13
13
{
14
14
<meta name =" keywords" content =" @Keywords" />
15
15
}
16
- @if (Description != null )
16
+ @if (Description is not null )
17
17
{
18
18
<meta name =" description" property =" og:description" content =" @Description" />
19
19
}
20
+
21
+ @if (ChildContent is not null )
22
+ {
23
+ @ChildContent
24
+ }
25
+
20
26
</HeadContent >
21
27
@code {
22
28
32
38
[Parameter ]
33
39
public string Keywords { get ; set ; }
34
40
35
- private string GetCanoncialUri ()
41
+ [Parameter ]
42
+ public RenderFragment ChildContent { get ; set ; }
43
+
44
+ private string GetCanoncialUri ()
36
45
{
37
46
var uri = new Uri (NavigationManager .Uri );
38
47
return uri .GetLeftPart (UriPartial .Path );
Original file line number Diff line number Diff line change 1
1
@using System .Text .Json
2
2
@using System .Text .Json .Serialization
3
3
4
- <HeadContent >
5
- <script suppress-error =" BL9992" type =" application/ld+json" >@StructuredDataJson </script >
6
- </HeadContent >
4
+ <script suppress-error =" BL9992" type =" application/ld+json" >@StructuredDataJson </script >
7
5
8
6
@code {
9
7
[Parameter ]
Original file line number Diff line number Diff line change 19
19
<OgData Title =" @BlogPost.Title"
20
20
AbsolutePreviewImageUrl =" @OgDataImage"
21
21
Description =" @(Markdown.ToPlainText(BlogPost.ShortDescription))"
22
- Keywords =" @BlogPost.TagsAsString" ></OgData >
23
- <StructuredData Headline =" @BlogPost.Title"
24
- PreviewImage =" @BlogPost.PreviewImageUrl"
25
- PreviewFallbackImage =" @BlogPost.PreviewImageUrlFallback"
26
- PublishedDate =" @BlogPost.UpdatedDate"
27
- Author =" @AppConfiguration.ProfileInformation?.Name" />
22
+ Keywords =" @BlogPost.TagsAsString" >
23
+ <StructuredData Headline =" @BlogPost.Title"
24
+ PreviewImage =" @BlogPost.PreviewImageUrl"
25
+ PreviewFallbackImage =" @BlogPost.PreviewImageUrlFallback"
26
+ PublishedDate =" @BlogPost.UpdatedDate"
27
+ Author =" @AppConfiguration.ProfileInformation?.Name" />
28
+ </OgData >
28
29
29
30
<div class =" d-flex justify-content-center pt-2 blog-outer-box" >
30
31
<div class =" content blog-container" >
Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ public class StructuredDataTests : TestContext
8
8
[ Fact ]
9
9
public void ShouldRenderRawMarkup ( )
10
10
{
11
- ComponentFactories . AddStub < HeadContent > ( ps => ps . Get ( p => p . ChildContent ) ) ;
12
-
13
11
var cut = RenderComponent < StructuredData > (
14
12
ps => ps . Add ( p => p . Author , "Steven" )
15
13
. Add ( p => p . Headline , "Headline" )
You can’t perform that action at this time.
0 commit comments