mirror of
https://github.com/Mabbs/mabbs.github.io
synced 2026-01-10 05:21:47 +08:00
Update 7 files
- /_includes/word_count.html - /_config.yml - /_layouts/default.html - /Gemfile - /js/rss-feed-preview.js - /_posts/2025-04-08-feed.md - /links.md
This commit is contained in:
1
Gemfile
1
Gemfile
@ -6,6 +6,7 @@ group :jekyll_plugins do
|
|||||||
gem "jekyll-assets", "~> 1.0.0"
|
gem "jekyll-assets", "~> 1.0.0"
|
||||||
gem "jekyll-sitemap", "~> 1.4.0"
|
gem "jekyll-sitemap", "~> 1.4.0"
|
||||||
gem "jekyll-feed", "~> 0.15.1"
|
gem "jekyll-feed", "~> 0.15.1"
|
||||||
|
gem "jekyll-include-cache", "~> 0.2.1"
|
||||||
gem "jekyll-theme-minimal"
|
gem "jekyll-theme-minimal"
|
||||||
gem "jekyll-paginate", "~> 1.1.0"
|
gem "jekyll-paginate", "~> 1.1.0"
|
||||||
gem "kramdown-parser-gfm", "~> 1.1.0"
|
gem "kramdown-parser-gfm", "~> 1.1.0"
|
||||||
|
|||||||
@ -10,6 +10,7 @@ paginate: 7
|
|||||||
plugins:
|
plugins:
|
||||||
- jekyll-sitemap
|
- jekyll-sitemap
|
||||||
- jekyll-feed
|
- jekyll-feed
|
||||||
|
- jekyll-include-cache
|
||||||
feed:
|
feed:
|
||||||
path: atom.xml
|
path: atom.xml
|
||||||
google_analytics: UA-137710294-1
|
google_analytics: UA-137710294-1
|
||||||
|
|||||||
1
_includes/word_count.html
Normal file
1
_includes/word_count.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
{% assign count = 0 %}{% for post in site.posts %}{% assign single_count = post.content | strip_html | strip_newlines | remove: " " | size %}{% assign count = count | plus: single_count %}{% endfor %}{{ count }}
|
||||||
File diff suppressed because one or more lines are too long
30
_posts/2025-04-08-feed.md
Normal file
30
_posts/2025-04-08-feed.md
Normal file
File diff suppressed because one or more lines are too long
@ -90,6 +90,17 @@
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const escapeHTML = (str) => {
|
||||||
|
return String(str).replace(/[&<>"'/]/g, (c) => ({
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
"'": ''',
|
||||||
|
'/': '/'
|
||||||
|
}[c]));
|
||||||
|
};
|
||||||
|
|
||||||
const renderFeedItems = (previewEl, items, siteName) => {
|
const renderFeedItems = (previewEl, items, siteName) => {
|
||||||
if (!items || items.length === 0) {
|
if (!items || items.length === 0) {
|
||||||
previewEl.innerHTML = '<p>No feed items found.</p>';
|
previewEl.innerHTML = '<p>No feed items found.</p>';
|
||||||
@ -99,13 +110,15 @@
|
|||||||
let html = `<h3>Latest from ${siteName}</h3><ul style="list-style: none; padding: 0; margin: 0;">`;
|
let html = `<h3>Latest from ${siteName}</h3><ul style="list-style: none; padding: 0; margin: 0;">`;
|
||||||
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
|
const safeTitle = escapeHTML(item.title);
|
||||||
|
const safeDate = escapeHTML(new Date(item.date).toLocaleDateString());
|
||||||
html += `
|
html += `
|
||||||
<li style="margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eee;">
|
<li style="margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eee;">
|
||||||
<div style="color: #24292e; font-weight: bold;">
|
<div style="color: #24292e; font-weight: bold;">
|
||||||
${item.title}
|
${safeTitle}
|
||||||
</div>
|
</div>
|
||||||
<div style="color: #586069; font-size: 12px; margin: 3px 0;">
|
<div style="color: #586069; font-size: 12px; margin: 3px 0;">
|
||||||
${new Date(item.date).toLocaleDateString()}
|
${safeDate}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
`;
|
`;
|
||||||
|
|||||||
3
links.md
3
links.md
@ -8,7 +8,7 @@ tags: [links]
|
|||||||
|
|
||||||
| Link | Description |
|
| Link | Description |
|
||||||
| - | - |
|
| - | - |
|
||||||
{% for item in site.data.links %}| <a href="{{ item.link }}" target="_blank" data-feed="{{ item.feed_url }}">{{ item.title }}</a> | {{ item.description }} |
|
{% for item in site.data.links %}| <a href="{{ item.link }}" target="_blank" rel="noopener" data-feed="{{ item.feed_url }}">{{ item.title }}</a> | {{ item.description }} |
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
## Links申请
|
## Links申请
|
||||||
@ -23,6 +23,7 @@ tags: [links]
|
|||||||
名称:Mayx的博客
|
名称:Mayx的博客
|
||||||
简介:Mayx's Home Page
|
简介:Mayx's Home Page
|
||||||
链接:<https://mabbs.github.io>
|
链接:<https://mabbs.github.io>
|
||||||
|
订阅:<https://mabbs.github.io/atom.xml>
|
||||||
头像:<https://avatars0.githubusercontent.com/u/17966333>
|
头像:<https://avatars0.githubusercontent.com/u/17966333>
|
||||||
Logo:<https://mabbs.github.io/favicon.ico>
|
Logo:<https://mabbs.github.io/favicon.ico>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user