var showTime = document.querySelector('.time'); getDate(); window.setInterval(getDate,1000);
functiongetDate(){ var date2 = + newDate(); var date4 = + newDate(2021, 03, 16, 18, 40, 41);
var date_count = date2 - date4 ; var t_second = date_count/1000; var d = parseInt(t_second/60/60/24); var h = parseInt(t_second/60/60%24); var m = parseInt(t_second/60&60); var s = parseInt(t_second%60);
d = d < 10 ? '0'+d : d; h = h < 10 ? '0'+h : h; m = m < 10 ? '0'+m : m; s = s < 10 ? '0'+s : s; showTime.innerText = '建站時至今日: ' + d + '天' + h + '時' + m + '分' + s + '秒'; }
目前服務器採用Intel Xeon CPU E5-2682 v4 @ 2.50GHz 1核心,
2G記憶體,5M 頻寬
git 倉庫位置 /home/git/blog.git,要常常執行Git
的垃圾回收命令,容量會滿
1 2
git gc
加入hexoc.sh
因為每一次要部署到伺服器上要打
1 2 3 4
>> hexo clean >> hexo g >> hexo d
很麻煩,所以寫入shell中,創建hexoc.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash
if [ $1 = 's' ] then echo localhost echo after generate hexo data, deploy localhost and open it at browser hexo g && hexo s -o elif [ $1 = 'd' ] then echo deploy echo after generate hexo data, deploy localhost and open it at browser hexo g && hexo d
fi
指令s
1
./hexoc.sh s
會一次性執行
1
hexo clean && hexo g && hexo s -o
指令d
1
./hexoc.sh d
則會一次性執行
1
hexo clean && hexo g && hexo d
加入update時間跟修改時間格式
在根目錄/scaffolds/post.md中,加入updated: { { date } }
1 2 3 4 5 6 7
--- title: {{ title }} date: {{ date }} updated: {{ date }} tags: ---
修改根目錄/_config.yml,改為updated_option: 'date'
1 2 3 4 5 6 7 8 9 10
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: 'date'
if [ $1 = 's update' ] then echo localhost and update time echo after generate hexo data, deploy localhost and open it at browser #hexo clean && ./source/_posts/updateFileTime.js #hexo clean && ./source/_posts/writeupdatetime.js hexo clean && ./source/_posts/writeupdatetime.js && ./source/_posts/updateFileTime.js && ./source/about/writeupdatetime.js && ./source/about/updateFileTime.js && hexo g && hexo s -o elif [ $1 = 'd update' ] then echo deploy and update time hexo clean && ./source/_posts/writeupdatetime.js && ./source/_posts/updateFileTime.js && ./source/about/writeupdatetime.js && ./source/about/updateFileTime.js && hexo g && hexo d elif [ $1 = 's' ] then echo localhost echo after generate hexo data, deploy localhost and open it at browser hexo g && hexo s -o elif [ $1 = 'd' ] then echo deploy echo after generate hexo data, deploy localhost and open it at browser hexo g && hexo d