diff options
author | mayx | 2025-06-16 11:14:46 +0000 |
---|---|---|
committer | mayx | 2025-06-16 11:14:46 +0000 |
commit | 6030f3c83c1448a74f6cfe4a5147e7ad9a64eb21 (patch) | |
tree | ce544a53bf07561f761db1e289dd86d5be23262f | |
parent | 840144b202b31eceefcec51ff6d8d2d5d906a151 (diff) |
Update 2 files
- /_layouts/post.html - /_config.yml
-rw-r--r-- | _config.yml | 4 | ||||
-rw-r--r-- | _layouts/post.html | 28 |
2 files changed, 20 insertions, 12 deletions
diff --git a/_config.yml b/_config.yml index 2a758f8..d5fde3f 100644 --- a/_config.yml +++ b/_config.yml @@ -17,4 +17,8 @@ webmaster_verifications: google: huTYdEesm8NaFymixMNqflyCp6Jfvd615j5Wq1i2PHc yandex: fc0e535abed800be bing: 0ADFCE64B3557DC4DC5F2DC224C5FDDD +social: + name: Mayx + links: + - https://github.com/Mabbs google_analytics: UA-137710294-1 diff --git a/_layouts/post.html b/_layouts/post.html index 1300465..8dae177 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -7,9 +7,9 @@ layout: default <p class="view">by <a class="p-author h-card" href="//github.com/{{ page.author | default: "Mabbs" }}">{{ page.author | default: site.author }}</a></p> <div id="outdate" style="display:none;"> - <hr /> + <hr /><p> 这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。 - <br /><br /> + </p> </div> <script> daysold = Math.floor((new Date().getTime() - new Date("{{ page.date | date_to_rfc822 }}").getTime()) / (24 * 60 * 60 * 1000)); @@ -73,7 +73,10 @@ layout: default <hr /> {% endif %} +{% if page.layout != "encrypt" %} {% include toc.html html=content sanitize=true h_max=3 %} +<hr /> +{% endif %} {% if page.layout == "encrypt" %} {{content}} {% else %} <main class="post-content e-content" role="main">{% capture a_post_content %}{% include anchor_headings.html html=content beforeHeading=true anchorBody="<svg class='octicon' viewBox='0 0 16 16' version='1.1' width='16' height='32' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>" %}{% endcapture %}{{ a_post_content | replace: '<br />', '</p><p>' }}</main> {% endif %} @@ -89,17 +92,18 @@ var suggest = $("#suggest-container"); $.get(BlogAPI + "/suggest?id={{ page.url }}&update=" + lastUpdated.valueOf(), function (data) { if (data.length) { getSearchJSON(function (search) { - suggest.empty() - const searchMap = new Map(search.map(item => [item.url, item])); - const merged = data.map(suggestObj => { - const searchObj = searchMap.get(suggestObj.id); - return searchObj ? { ...searchObj } : null; - }); - merged.forEach(element => { - if (element) { - suggest.append("<a href=" + element.url + ">" + element.title + "</a> - " + element.date + "<br />"); + suggest.empty(); + var searchMap = {}; + for (var i = 0; i < search.length; i++) { + searchMap[search[i].url] = search[i]; + } + + for (var j = 0; j < data.length; j++) { + var item = searchMap[data[j].id]; + if (item) { + suggest.append('<a href="' + item.url + '">' + item.title + '</a> - ' + item.date + '<br />'); } - }); + } }); } else { suggest.html("暂无推荐文章……"); |