npm i hexo-renderer-multi-markdown-it --save npm i hexo-autoprefixer --save npm i hexo-algolia --save npm i hexo-algoliasearch --save npm i hexo-symbols-count-time --save npm i hexo-feed --save
# Dark Mode # By default, the page judges whether to turn on the dark mode according to the device settings or user selection # if `true`, the page will be displayed directly as Dark Mode, unless the user makes another choice # 夜间模式 darkmode:false
# By default the page will automatically scroll to the last viewed position # if `false`, automatic positioning will be turned off # 自动定位 自动定位到上次浏览的位置 auto_scroll:true
# Whether to show the loading cat # 是否显示页面加载动漫 就是每次都看到的那个猫猫 loader: start:true# When entering the page switch:true# When switching to another page
# 加载谷歌字体 font: enable:true # Font options: # `external: true` will load this font family from `host` above. # `family: Times New Roman`. Without any quotes. # `size: x.x`. Use `em` as unit. Default: 1 (16px)
# Global font settings used for all elements inside <body>. global: external:true family:Mulish size:
# Font settings for alternate title. # 备用字体 logo: external:true family:FrederickatheGreat size:3.5
# Font settings for site title. # 站点字体 title: external:true family:NotoSerifJP size:2.5
# Font settings for headlines (<h1> to <h6>). headings: external:true family:NotoSerifSC size:
# Font settings for posts. posts: external:true family:
# Font settings for <code> and code blocks. codes: external:true family:Inconsolata
# project of https://www.iconfont.cn/ # //at.alicdn.com/t/font_1832207_c8i9n1ulxlt.css => 1832207_c8i9n1ulxlt iconfont:"1832207_igi8uaupcus"
# Social Links # Usage: `Key: permalink || icon || color` # Key is the link label showing to end users. # Value before `||` delimiter is the target permalink, # secend value is the name of Font icon. social: github:https://github.com/dabing85||github||"#191717" #google: https://plus.google.com/yourname || google #twitter: https://twitter.com/yourname || twitter || "#00aff0" #zhihu: https://www.zhihu.com/people/yourname || zhihu || "#1e88e5" #music: https://music.163.com/#/user/home?id=yourid || cloud-music || "#e60026" #weibo: https://weibo.com/yourname || weibo || "#ea716e" #about: https://about.me/yourname || address-card || "#3b5998" #email: mailto:yourname@mail.com || envelope || "#55acd5" #facebook: https://www.facebook.com/yourname || facebook #stackoverflow: https://stackoverflow.com/yourname || stack-overflow #youtube: https://youtube.com/yourname || youtube #instagram: https://instagram.com/yourname || instagram #skype: skype:yourname?call|chat || skype #douban: https://www.douban.com/people/yourname/ || douban
sidebar: # Sidebar Position. # position: left position:right # Replace the default avatar image and set the url here. avatar:avatar.jpg
widgets: # if true, will show random posts # 显示随机文章 random_posts:true # if true, will show recent comments # 显示最近评论 recent_comments:true
footer: # Specify the date when the site was setup. If not defined, current year will be used. # 页尾全站统计局 since:2010 icon: name:sakurarotate # Change the color of icon, using Hex Code. color:"#ffc0cb" # Dependencies: https://github.com/theme-next/hexo-symbols-count-time count:false powered:true
# 奖励 这里我不需要 # Reward (Donate) #reward: # # If true, reward will be displayed in every article by default. # enable: true # account: # wechatpay: /wechatpay.png # alipay: /alipay.png # paypal: /paypal.png
# TagCloud settings for tags page. tagcloud: # All values below are same as default, change them by yourself. min:16# Minimun font size in px max:22# Maxium font size in px start:"#72cecf"# Start color (hex, rgba, hsla or color keywords) end:"#ffbac3"# End color (hex, rgba, hsla or color keywords) amount:200# Amount of tags, change it if you have more than 200 tags
# --------------------------------------------------------------- # Third Party Plugins & Services Settings # ---------------------------------------------------------------
# Creative Commons 4.0 International License. # See: https://creativecommons.org/share-your-work/licensing-types-examples # Available values of license: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | zero # You can set a language value if you prefer a translated version of CC license, e.g. deed.zh # CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org creative_commons: license:by-nc-sa language:zh-CN# deed.zh
# Comments # Valine # For more information: https://github.com/amehime/MiniValine valine: appId:# 配置你的appId appKey:# 配置你的appKey placeholder:ヽ(○´∀`)ノ♪# Comment box placeholder avatar:mp# Gravatar style : mp, identicon, monsterid, wavatar, robohash, retro pageSize:10# Pagination size lang:zh-CN visitor:true# Article reading statistic 文章阅读量统计 NoRecordIP:false# Whether to record the commenter IP serverURLs:# When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in) powerMode:true tagMeta: visitor:新朋友 master:主人 friend:小伙伴 investor:金主粑粑 tagColor: master:"var(--color-orange)" friend:"var(--color-aqua)" investor:"var(--color-pink)" tagMember: master: # - hash of master@email.com # - hash of master2@email.com friend: # - hash of friend@email.com # - hash of friend2@email.com investor: # - hash of investor1@email.com
# Quicklink Support # For more information: https://github.com/GoogleChromeLabs/quicklink quicklink: # Custom a time in milliseconds by which the browser must execute prefetching. timeout:3000 # Default (true) will attempt to use the fetch() API if supported (rather than link[rel=prefetch]). priority:true
# For more flexibility you can add some patterns (RegExp, Function, or Array) to ignores. # See: https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patterns ignores:
#! --------------------------------------------------------------- #! DO NOT EDIT THE FOLLOWING `vendors` SETTINGS #! UNLESS YOU KNOW WHAT YOU ARE DOING #! Script dependencies will be combined with jsDelivr (cdn.jsdelivr.net) #! --------------------------------------------------------------- vendors: css: katex:npm/katex@0.12.0/dist/katex.min.css comment:css/comment.css fancybox:combine/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css,npm/justifiedGallery@3.8.1/dist/css/justifiedGallery.min.css js: pace:npm/pace-js@1.0.2/pace.min.js pjax:npm/pjax@0.2.8/pjax.min.js fetch:npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js anime:npm/animejs@3.2.0/lib/anime.min.js algolia:npm/algoliasearch@4/dist/algoliasearch-lite.umd.js instantsearch:npm/instantsearch.js@4/dist/instantsearch.production.min.js lazyload:npm/lozad@1/dist/lozad.min.js quicklink:npm/quicklink@2/dist/quicklink.umd.js fancybox:combine/npm/jquery@3.5.1/dist/jquery.min.js,npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js,npm/justifiedGallery@3.8.1/dist/js/jquery.justifiedGallery.min.js valine:gh/amehime/MiniValine@4.2.2-beta10/dist/MiniValine.min.js copy_tex:npm/katex@0.12.0/dist/contrib/copy-tex.min.js chart:npm/frappe-charts@1.5.0/dist/frappe-charts.min.iife.min.js
# Site title: subtitle:'不在能知,乃在能行' description:'欢迎来到大冰的笔记空间~这里主要会记录编程学习笔记🌸' keywords: author:Dabing-He language:zh-CN timezone:''
# URL ## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project' url:http://example.com permalink::title/#:year/:month/:day/:title/ permalink_defaults: pretty_urls: trailing_index:true# Set to false to remove trailing 'index.html' from permalinks trailing_html:true# Set to false to remove trailing '.html' from permalinks
# Writing new_post_name::title.md# File name of new posts default_layout:post titlecase:false# Transform title into titlecase external_link: enable:true# Open external links in new tab field:site# Apply to the whole site exclude:'' filename_case:0 render_drafts:false post_asset_folder:false relative_link:false future:true highlight: enable:false line_number:true auto_detect:true tab_replace:'' wrap:true hljs:false prismjs: enable:false preprocess:true line_number:true tab_replace:''
# Home page setting # path: Root path for your blogs index page. (default = '') # per_page: Posts displayed per page. (0 = disable pagination) # order_by: Posts order. (Order by date descending by default) index_generator: path:'' per_page:10 order_by:-date
# Category & Tag # 这里配置分类和标签 default_category:uncategorized category_map: tag_map:
# Metadata elements ## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta meta_generator:true
# Date / Time format ## Hexo uses Moment.js to parse and display date ## You can customize the date format as defined in ## http://momentjs.com/docs/#/displaying/format/ date_format:YYYY-MM-DD time_format:HH:mm:ss ## updated_option supports 'mtime', 'date', 'empty' updated_option:'mtime'
# Pagination ## Set per_page to 0 to disable pagination per_page:10 pagination_dir:page
# Include / Exclude file(s) ## include:/exclude: options only apply to the 'source/' folder include: exclude: ignore:
const getIndexByWord = function(word, text, caseSensitive) { if (CONFIG.localSearch.unescape) { var div = document.createElement('div'); div.innerText = word; word = div.innerHTML; } var wordLen = word.length; if (wordLen === 0) { return []; } var startPosition = 0; var position = []; var index = []; if (!caseSensitive) { text = text.toLowerCase(); word = word.toLowerCase(); }
while ((position = text.indexOf(word, startPosition)) > -1) { index.push({position:position, word:word}); startPosition = position + wordLen; } return index; };
// Merge hits into slices const mergeIntoSlice = function(start, end, index, searchText) { var item = index[index.length - 1]; var position = item.position; var word = item.word; var hits = []; var searchTextCountInSlice = 0; while (position + word.length <= end && index.length !== 0) { if (word === searchText) { searchTextCountInSlice++; } hits.push({ position:position, length: word.length });
var wordEnd = position + word.length;
// Move to next position of hit index.pop(); while (index.length !== 0) { item = index[index.length - 1]; position = item.position; word = item.word; if (wordEnd > position) { index.pop(); } else { break; } } } return { hits:hits, start:start, end:end, searchTextCount: searchTextCountInSlice }; }
// Highlight title and content const highlightKeyword = function(text, slice) { var result = ''; var prevEnd = slice.start; slice.hits.forEach(function(hit) { result += text.substring(prevEnd, hit.position); var end = hit.position + hit.length; result += '<mark>'+ text.substring(hit.position, end)+'</mark>'; prevEnd = end; }); result += text.substring(prevEnd, slice.end); return result; };
const addPage = function(index, current_page) { var classContent = ''; var numberContent = '<a class="#search-pagination page-number"aria-label="'+ (index + 1) +'"href="#">'+(index+1)+'</a>'; if (index === current_page) { classContent = '#search-pagination pagination-item current'; } else { classContent = '#search-pagination pagination-item'; } var page = '<li class="'+classContent+'" id="page-'+(index + 1)+'">'+numberContent+'</li>'; return page; } const addPaginationEvents = function(start_page, end_page) { if (total_pages <= 0) { return; } const onPrevPageClick = function(event) { if (current_page > 0) { current_page -= 1; } if (current_page < start_page) { start_page = current_page; end_page = Math.min(end_page, start_page + max_page_on_show); } pagination(); }; const onNextPageClick = function(event) { if ((current_page + 1) < total_pages) { current_page += 1; } if (current_page > end_page) { end_page = current_page; start_page = Math.max(0, end_page - max_page_on_show); } pagination(); }; const onPageClick = function(event) { var page_number = parseInt(event.target.ariaLabel); current_page = page_number - 1; // note minus 1 here pagination(); }; var prevPage = document.getElementById('prev-page'); if(prevPage != null)prevPage.addEventListener('click', onPrevPageClick); var nextPage = document.getElementById('next-page'); if(nextPage != null) nextPage.addEventListener('click', onNextPageClick); for (var i = start_page; i < end_page; i += 1) { var page = document.getElementById('page-'+(i + 1)); if(page != null)page.addEventListener('click', onPageClick); } };
paginationContent.innerHTML = ''; // clear var begin_index = Math.min(current_page * pageSize, resultItems.length); var end_index = Math.min(begin_index + pageSize, resultItems.length);
resultContent.innerHTML = resultItems.slice(begin_index, end_index).map(function(result) {return result.item}).join(''); start_page = Math.max(0, total_pages - max_page_on_show); end_page = start_page + Math.min(total_pages, max_page_on_show); var pageContent = '<div class="#search-pagination">'; pageContent += '<div class="#search-pagination pagination">'; pageContent += '<ul>'; if (total_pages > 0) { // add prev page arrow, when no prev page not selectable pageContent += addPrevPage(current_page); for (var i = start_page; i < end_page; i += 1) { pageContent += addPage(i, current_page); } // add next page arrow, when no next page not selectable pageContent += addNextPage(current_page); } pageContent += '</ul>'; pageContent += '</div>'; pageContent += '</div>'; paginationContent.innerHTML = pageContent; addPaginationEvents(start_page, end_page); resultContent.scrollTop = 0; // scroll to top window.pjax && window.pjax.refresh(resultContent); };
const inputEventFunction = function() { if (!isFetched) { console.log("Data not fetched."); return; }
var searchText = input.value.trim().toLowerCase(); var keywords = searchText.split(/[-\s]+/); if (keywords.length > 1) { keywords.push(searchText); } resultItems = []; if (searchText.length > 0) { // Perform local searching datas.forEach(function(index) { var categories = index.categories, title=index.title, content=index.content, url=index.url; var titleInLowerCase = title.toLowerCase(); var contentInLowerCase = content.toLowerCase(); var indexOfTitle = []; var indexOfContent = []; var searchTextCount = 0; keywords.forEach( function(keyword) { indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false)); indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false)); }); // Show search results if (indexOfTitle.length > 0 || indexOfContent.length > 0) { var hitCount = indexOfTitle.length + indexOfContent.length; // Sort index by position of keyword [indexOfTitle, indexOfContent].forEach(function(index) { index.sort(function(itemLeft, itemRight) { if (itemRight.position !== itemLeft.position) { return itemRight.position - itemLeft.position; } return itemLeft.word.length - item.word.length; }); });
var slicesOfTitle = []; if (indexOfTitle.length !== 0) { var tmp = mergeIntoSlice(0, title.length, indexOfTitle, searchText); searchTextCount += tmp.searchTextCountInSlice; slicesOfTitle.push(tmp); } var slicesOfContent = []; while (indexOfContent.length !== 0) { var item = indexOfContent[indexOfContent.length - 1]; var position = item.position; var word = item.word; // Cut out 100 characters var start = position - 20; var end = position + 30; if (start < 0) { start = 0; } if (end < position + word.length) { end = position + word.length; } if (end > content.length) { end = content.length; } var tmp = mergeIntoSlice(start, end, indexOfContent, searchText); searchTextCount += tmp.searchTextCountInSlice; slicesOfContent.push(tmp); } // Sort slices in content by search text's count and hits' count slicesOfContent.sort( function(sliceLeft, sliceRight) { if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) { return sliceRight.searchTextCount - sliceLeft.searchTextCount; } elseif (sliceLeft.hits.length !== sliceRight.hits.length) { return sliceRight.hits.length - sliceLeft.hits.length; } return sliceLeft.start - sliceRight.start; });
// Select top N slices in content var upperBound = parseInt(CONFIG.localSearch.pageSize, 10); if (upperBound >= 0) { slicesOfContent = slicesOfContent.slice(0, upperBound); }
valine: appId:#Your_appId appKey:#Your_appkey placeholder:ヽ(○´∀`)ノ♪# Comment box placeholder avatar:mp# Gravatar style : mp, identicon, monsterid, wavatar, robohash, retro pageSize:10# Pagination size lang:zh-CN visitor:true# 文章访问量统计 NoRecordIP:false# 不记录 IP serverURLs:# When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in) powerMode:true# 默认打开评论框输入特效 tagMeta: visitor:新朋友 master:主人 friend:小伙伴 investor:金主粑粑 tagColor: master:"var(--color-orange)" friend:"var(--color-aqua)" investor:"var(--color-pink)" tagMember: master: # - hash of master@email.com # - hash of master2@email.com friend: # - hash of friend@email.com # - hash of friend2@email.com investor: # - hash of investor1@email.com