Browse Source

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
mayx 11 tháng trước cách đây
mục cha
commit
9170efdaa3
7 tập tin đã thay đổi với 51 bổ sung4 xóa
  1. 1 0
      Gemfile
  2. 1 0
      _config.yml
  3. 1 0
      _includes/word_count.html
  4. 1 1
      _layouts/default.html
  5. 30 0
      _posts/2025-04-08-feed.md
  6. 15 2
      js/rss-feed-preview.js
  7. 2 1
      links.md

+ 1 - 0
Gemfile

@@ -6,6 +6,7 @@ group :jekyll_plugins do
   gem "jekyll-assets", "~> 1.0.0"
   gem "jekyll-sitemap", "~> 1.4.0"
   gem "jekyll-feed", "~> 0.15.1"
+  gem "jekyll-include-cache", "~> 0.2.1"
   gem "jekyll-theme-minimal"
   gem "jekyll-paginate", "~> 1.1.0"
   gem "kramdown-parser-gfm", "~> 1.1.0"

+ 1 - 0
_config.yml

@@ -10,6 +10,7 @@ paginate: 7
 plugins:
   - jekyll-sitemap
   - jekyll-feed
+  - jekyll-include-cache
 feed:
   path: atom.xml
 google_analytics: UA-137710294-1

+ 1 - 0
_includes/word_count.html

@@ -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 }}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
_layouts/default.html


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 0
_posts/2025-04-08-feed.md


+ 15 - 2
js/rss-feed-preview.js

@@ -90,6 +90,17 @@
       return null;
     };
   
+    const escapeHTML = (str) => {
+      return String(str).replace(/[&<>"'/]/g, (c) => ({
+        '&': '&amp;',
+        '<': '&lt;',
+        '>': '&gt;',
+        '"': '&quot;',
+        "'": '&#39;',
+        '/': '&#x2F;'
+      }[c]));
+    };
+
     const renderFeedItems = (previewEl, items, siteName) => {
       if (!items || items.length === 0) {
         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;">`;
   
       items.forEach(item => {
+        const safeTitle = escapeHTML(item.title);
+        const safeDate = escapeHTML(new Date(item.date).toLocaleDateString());
         html += `
           <li style="margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eee;">
             <div style="color: #24292e; font-weight: bold;">
-              ${item.title}
+              ${safeTitle}
             </div>
             <div style="color: #586069; font-size: 12px; margin: 3px 0;">
-              ${new Date(item.date).toLocaleDateString()}
+              ${safeDate}
             </div>
           </li>
         `;

+ 2 - 1
links.md

@@ -8,7 +8,7 @@ tags: [links]
 
 | 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 %}
 
 ## Links申请
@@ -23,6 +23,7 @@ tags: [links]
 名称:Mayx的博客   
 简介:Mayx's Home Page   
 链接:<https://mabbs.github.io>   
+订阅:<https://mabbs.github.io/atom.xml>   
 头像:<https://avatars0.githubusercontent.com/u/17966333>   
 Logo:<https://mabbs.github.io/favicon.ico>