新增rss功能
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<div id="comment">
|
||||
<div id="comment">
|
||||
<section class="">
|
||||
<div class="">
|
||||
|
||||
@@ -70,14 +70,6 @@
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% if Model.Comments.HasPreviousPage %}
|
||||
<a class="enabled current" href="?page={{ Model.Comments.PreviousPage }}">上一页</a>
|
||||
{% endif %}
|
||||
|
||||
{% if Model.Comments.HasNextPage %}
|
||||
<a class="enabled current" href="?page={{ Model.Comments.NextPage }}">下一页</a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
@@ -91,31 +83,34 @@
|
||||
{% section scripts %}
|
||||
<script>
|
||||
document.getElementById("createComment").addEventListener("click", function(){
|
||||
var nickName = document.getElementsByName('nickName')[0].value;
|
||||
var email = document.getElementsByName('email')[0].value;
|
||||
var content = document.getElementsByName('content')[0].value;
|
||||
var url = document.getElementsByName('url')[0].value;
|
||||
var targetId = document.getElementsByName('targetId')[0].value;
|
||||
axios.post("/comments",{
|
||||
targetId:targetId,
|
||||
nickName:nickName,
|
||||
email: email,
|
||||
content: content,
|
||||
url: url
|
||||
}).catch(function (error) {
|
||||
var errorMessage = "";
|
||||
if (error.response) {
|
||||
if (error.response.status == 422) {
|
||||
const errors = Object.values(error.response.data.errors);
|
||||
const values = Array.from(new Set(errors.flat()));
|
||||
errorMessage = values.join(' ');
|
||||
} else {
|
||||
errorMessage = error.response.data.detail;
|
||||
}
|
||||
} else {
|
||||
errorMessage = "您的请求未能成功处理,可能是服务器开小差了!";
|
||||
}
|
||||
document.getElementById('comment-error').innerHTML = '<p>'+errorMessage+'</p>';
|
||||
var nickName = document.getElementsByName('nickName')[0].value;
|
||||
var email = document.getElementsByName('email').value;
|
||||
var content = document.getElementsByName('content').value;
|
||||
var url = document.getElementsByName('url').value;
|
||||
var targetId = document.getElementsByName('targetId').value;
|
||||
axios.post("/comments",{
|
||||
targetId:targetId,
|
||||
nickName:nickName,
|
||||
email: email,
|
||||
content: content,
|
||||
url: url
|
||||
}).catch(function (error) {
|
||||
var errorMessage = "";
|
||||
if (error.response) {
|
||||
if (error.response.status == 422) {
|
||||
const errors = Object.values(error.response.data.errors);
|
||||
console.log(errors);
|
||||
const values = Array.from(new Set(errors.flat()));
|
||||
console.log(values);
|
||||
errorMessage = values.join(' ');
|
||||
} else {
|
||||
errorMessage = error.response.data.detail;
|
||||
}
|
||||
} else {
|
||||
errorMessage = "您的请求未能成功处理,可能是服务器开小差了!";
|
||||
}
|
||||
document.getElementById('comment-error').innerHTML = '<p>'+errorMessage+'</p>';
|
||||
console.log(errorMessage);
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<span class="footer-item">
|
||||
© {{ "now" | format_date: "yyyy" }}
|
||||
|
||||
<a href="{{ Model.Blog.Url }}" title="{{ Model.Blog.Name }}">{{ Model.Blog.Name }}</a> Powered by <a href="https://blog.yescent.com">Hyrule</a>
|
||||
<a href="{{ Model.Blog.Url }}" title="{{ Model.Blog.Name }}">{{ Model.Blog.Name }}</a> Powered by .NET 8.0
|
||||
</span>
|
||||
<span class="footer-item">
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
{% partial '_SiteCategories' %}
|
||||
{% partial '_Tags' %}
|
||||
{% partial '_Archive' %}
|
||||
{% partial '_Rss' %}
|
||||
|
||||
</div>
|
||||
</main>
|
||||
{% partial '_Footer' %}
|
||||
|
||||
5
Yes.Blog/wwwroot/defaulttheme/_Rss.liquid
Normal file
5
Yes.Blog/wwwroot/defaulttheme/_Rss.liquid
Normal file
@@ -0,0 +1,5 @@
|
||||
<div class="side-tags">
|
||||
<a href="/feed.xml" target="_blank">
|
||||
<i class="i-rss"></i>RSS 订阅
|
||||
</a>
|
||||
</div>
|
||||
@@ -842,7 +842,6 @@ pre .copyCodeButton:hover {
|
||||
#comment-error p{
|
||||
color:#ff0000;
|
||||
font-size:12px;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
|
||||
@@ -875,4 +874,12 @@ pre .copyCodeButton:hover {
|
||||
text-decoration: none;
|
||||
color: var(--color-fg-hyperlink);
|
||||
padding-left:10px;
|
||||
}
|
||||
.i-rss {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: url("../rss.png") no-repeat;
|
||||
margin-right: 8px;
|
||||
vertical-align: sub;
|
||||
}
|
||||
BIN
Yes.Blog/wwwroot/defaulttheme/rss.png
Normal file
BIN
Yes.Blog/wwwroot/defaulttheme/rss.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 324 B |
24
Yes.Blog/wwwroot/feed.xml
Normal file
24
Yes.Blog/wwwroot/feed.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-16"?>
|
||||
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
|
||||
<channel>
|
||||
<title>我的博客</title>
|
||||
<link>https://blog.yescent.com</link>
|
||||
<description>Hyrule 是一个简洁的开源博客系统</description>
|
||||
<language>zh-CN</language>
|
||||
<lastBuildDate>Thu, 15 May 2025 04:52:30 GMT</lastBuildDate>
|
||||
<pubDate>Wed, 07 May 2025 10:02:22 GMT</pubDate>
|
||||
<atom:link href="https://blog.yescent.com/feed/" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>欢迎使用 Hyrule</title>
|
||||
<link>https://blog.yescent.com//post/start.html</link>
|
||||
<guid isPermaLink="true">https://blog.yescent.com//post/start.html</guid>
|
||||
<pubDate>周六, 10 5月 2025 16:15:05 +08:00</pubDate>
|
||||
<dc:creator>1</dc:creator>
|
||||
<description><![CDATA[如果您看到这篇文章,表示您的 blog 已经安装成功.]]></description>
|
||||
<content:encoded xml:lang="zh-CN"><![CDATA[如果您看到这篇文章,表示您的 blog 已经安装成功.]]></content:encoded>
|
||||
<slash:comments>0</slash:comments>
|
||||
<comments>https://blog.yescent.com//post/start.html#comments</comments>
|
||||
<wfw:commentRss>https://blog.yescent.com/feed/</wfw:commentRss>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
Reference in New Issue
Block a user