Skip to content

Commit

Permalink
[rss] fix link value - use the base url and not the generated file
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Jul 31, 2024
1 parent 2113bb0 commit 4c119e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/SBSharp.Core/SBSharp/Core/Command/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,17 @@ var page in pages
: (
header.Attributes.TryGetValue("description", out var d2)
? d2
: defaultDescription(page.Item2)
: (
header.Attributes.TryGetValue("summary", out var d3)
? d3
: defaultDescription(page.Item2)
)
);
var pageItem =
" <item>\n"
+ $" <title>{SecurityElement.Escape(header.Title)}</title>\n"
+ $" <description>{SecurityElement.Escape(description)}</description>\n"
+ $" <link>{configuration.Output.Rss.Location}/{page.Item1}</link>\n"
+ $" <link>{configuration.Output.Rss.Link}/{page.Item1}</link>\n"
+ $" <guid isPermaLink=\"false\">{page.Item1}</guid>\n"
+ $" <pubDate>{new DateTime(page.Item2.PublishedOn, TimeOnly.MinValue).ToString(dateFormat)}</pubDate>\n"
+ " </item>\n";
Expand Down
4 changes: 2 additions & 2 deletions test/SBSharp.Tests/SBSharp/Core/Command/BuildCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public async Task Build()
<title>Index</title>
<description>Index
Bla bla</description>
<link>rss.xml/index.adoc</link>
<link>http://localhost:4200/index.adoc</link>
<guid isPermaLink="false">index.adoc</guid>
<pubDate>$date</pubDate>
</item>
<item>
<title>Post #1</title>
<description>Post #1
A post with default template.</description>
<link>rss.xml/blog/post-1/simple-test.adoc</link>
<link>http://localhost:4200/blog/post-1/simple-test.adoc</link>
<guid isPermaLink="false">blog/post-1/simple-test.adoc</guid>
<pubDate>$date</pubDate>
</item>
Expand Down

0 comments on commit 4c119e7

Please sign in to comment.