mirror of https://gitlab.com/curben/blog
				
				
				
			feat: 'updated_option' config
- post.updated will be null if not set in front-matter - https://github.com/hexojs/hexo/pull/4278
This commit is contained in:
		
							parent
							
								
									0752e3382c
								
							
						
					
					
						commit
						d0ac052b59
					
				|  | @ -9,7 +9,7 @@ | ||||||
| - Installed [hexo-nofollow](https://github.com/curbengh/hexo-nofollow) for SEO purpose to prevent search engines from following external links. | - Installed [hexo-nofollow](https://github.com/curbengh/hexo-nofollow) for SEO purpose to prevent search engines from following external links. | ||||||
| - Installed [hexo-yam](https://github.com/curbengh/hexo-yam) to pre-compress static assets (html, css, js and svg). | - Installed [hexo-yam](https://github.com/curbengh/hexo-yam) to pre-compress static assets (html, css, js and svg). | ||||||
| - [copy-button.js](/scripts/copy-button.js) - A [filter](https://hexo.io/api/filter) plugin to add a copy button to each code block. | - [copy-button.js](/scripts/copy-button.js) - A [filter](https://hexo.io/api/filter) plugin to add a copy button to each code block. | ||||||
| - [feed](/scripts/feed) - A generator plugin to generate [an RSS feed](https://en.wikipedia.org/wiki/Web_feed). Modified from [hexo-generator-feed](https://github.com/hexojs/hexo-generator-feed) to use `post.lastUpdated` instead of `post.updated`. | - [feed](/scripts/feed) - A generator plugin to generate [an RSS feed](https://en.wikipedia.org/wiki/Web_feed). Modified from [hexo-generator-feed](https://github.com/hexojs/hexo-generator-feed) to use `post.updated` instead of `post.updated`. | ||||||
| - [heading-link.js](/scripts/heading-link.js) - A filter plugin to add a link button next to each heading. | - [heading-link.js](/scripts/heading-link.js) - A filter plugin to add a link button next to each heading. | ||||||
| - [image.js](/scripts/image.js) - A [tag](https://hexo.io/api/tag) plugin to easily embed images in a post with responsive image support. | - [image.js](/scripts/image.js) - A [tag](https://hexo.io/api/tag) plugin to easily embed images in a post with responsive image support. | ||||||
| - [link.js](/scripts/link.js) - A [helper](https://hexo.io/api/helper) plugin to add a link. Modified from [link_to.js](https://github.com/hexojs/hexo/blob/master/lib/plugins/helper/link_to.js) to remove title attribute and 'external' option. | - [link.js](/scripts/link.js) - A [helper](https://hexo.io/api/helper) plugin to add a link. Modified from [link_to.js](https://github.com/hexojs/hexo/blob/master/lib/plugins/helper/link_to.js) to remove title attribute and 'external' option. | ||||||
|  | @ -25,6 +25,7 @@ The following are the major changes I made compared to the upstream. | ||||||
| - Removed unused packages, [hexo-generator-category](https://github.com/hexojs/hexo-generator-category) and [hexo-renderer-stylus](https://github.com/hexojs/hexo-renderer-stylus) from the [default packages](https://github.com/hexojs/hexo-starter/blob/571320ba41a83e065d7560e050eb3fa63ad74a57/package.json#L9-L17). | - Removed unused packages, [hexo-generator-category](https://github.com/hexojs/hexo-generator-category) and [hexo-renderer-stylus](https://github.com/hexojs/hexo-renderer-stylus) from the [default packages](https://github.com/hexojs/hexo-starter/blob/571320ba41a83e065d7560e050eb3fa63ad74a57/package.json#L9-L17). | ||||||
| - Replaced the bundled Landscape theme with Typing theme. | - Replaced the bundled Landscape theme with Typing theme. | ||||||
| - Add `lastUpdated` to the front-matter to manually set updated time of a post, instead of using `post.updated`. | - Add `lastUpdated` to the front-matter to manually set updated time of a post, instead of using `post.updated`. | ||||||
|  |   * This is no longer necessary, thanks to [`updated_option`](https://github.com/hexojs/hexo/pull/4278) feature. | ||||||
| 
 | 
 | ||||||
| ### [Chameleon theme](/themes/chameleon) | ### [Chameleon theme](/themes/chameleon) | ||||||
| Chameleon is a fork of [Typing](https://github.com/geekplux/hexo-theme-typing) theme, rewrote from scratch with the following changes/features: | Chameleon is a fork of [Typing](https://github.com/geekplux/hexo-theme-typing) theme, rewrote from scratch with the following changes/features: | ||||||
|  |  | ||||||
|  | @ -63,6 +63,7 @@ tag_map: | ||||||
| ## http://momentjs.com/docs/#/displaying/format/ | ## http://momentjs.com/docs/#/displaying/format/ | ||||||
| date_format: YYYY-MM-DD | date_format: YYYY-MM-DD | ||||||
| time_format: HH:mm:ss | time_format: HH:mm:ss | ||||||
|  | updated_option: empty | ||||||
| 
 | 
 | ||||||
| # Pagination | # Pagination | ||||||
| ## Set per_page to 0 to disable pagination | ## Set per_page to 0 to disable pagination | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Firefox, Cross-Origin and AliExpress | title: Firefox, Cross-Origin and AliExpress | ||||||
| excerpt: AliExpress login doesn't show up on Firefox when there is a strict cross-origin policy. | excerpt: AliExpress login doesn't show up on Firefox when there is a strict cross-origin policy. | ||||||
| date: 2019-02-28 | date: 2019-02-28 | ||||||
| lastUpdated: 2019-04-29 | updated: 2019-04-29 | ||||||
| tags: | tags: | ||||||
| - firefox | - firefox | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: "Setup Caddy as a reverse proxy on NixOS (Part 1: Installation)" | title: "Setup Caddy as a reverse proxy on NixOS (Part 1: Installation)" | ||||||
| excerpt: "Part 1: Installing NixOS" | excerpt: "Part 1: Installing NixOS" | ||||||
| date: 2020-02-23 | date: 2020-02-23 | ||||||
| lastUpdated: 2020-04-22 | updated: 2020-04-22 | ||||||
| tags: | tags: | ||||||
| - server | - server | ||||||
| - linux | - linux | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: "Setup Caddy as a reverse proxy on NixOS (Part 2: Hardening)" | title: "Setup Caddy as a reverse proxy on NixOS (Part 2: Hardening)" | ||||||
| excerpt: "Part 2: Securing NixOS" | excerpt: "Part 2: Securing NixOS" | ||||||
| date: 2020-03-04 | date: 2020-03-04 | ||||||
| lastUpdated: 2020-04-22 | updated: 2020-04-22 | ||||||
| tags: | tags: | ||||||
| - server | - server | ||||||
| - linux | - linux | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: "Setup Caddy as a reverse proxy on NixOS (Part 3: Caddy)" | title: "Setup Caddy as a reverse proxy on NixOS (Part 3: Caddy)" | ||||||
| excerpt: "Part 3: Configure Caddy" | excerpt: "Part 3: Configure Caddy" | ||||||
| date: 2020-03-14 | date: 2020-03-14 | ||||||
| lastUpdated: 2020-04-08 | updated: 2020-04-08 | ||||||
| tags: | tags: | ||||||
| - server | - server | ||||||
| - linux | - linux | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Upgrading Caddy reverse proxy from v1 to v2 syntax | title: Upgrading Caddy reverse proxy from v1 to v2 syntax | ||||||
| excerpt: route, strip_prefix, rewrite | excerpt: route, strip_prefix, rewrite | ||||||
| date: 2020-05-23 | date: 2020-05-23 | ||||||
| lastUpdated: 2020-06-21 | updated: 2020-06-21 | ||||||
| tags: | tags: | ||||||
| - server | - server | ||||||
| - caddy | - caddy | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Edit multiple questions on LimeSurvey | title: Edit multiple questions on LimeSurvey | ||||||
| excerpt: List Questions view allows you to edit multiple questions at the same time. | excerpt: List Questions view allows you to edit multiple questions at the same time. | ||||||
| date: 2018-10-18 | date: 2018-10-18 | ||||||
| lastUpdated: 2018-10-26 | updated: 2018-10-26 | ||||||
| tags: | tags: | ||||||
| - stats | - stats | ||||||
| - limesurvey | - limesurvey | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Access Facebook/Instagram/Whatsapp/Google in China | title: Access Facebook/Instagram/Whatsapp/Google in China | ||||||
| excerpt: Data roaming, commercial VPN provider to rolling your own VPN. | excerpt: Data roaming, commercial VPN provider to rolling your own VPN. | ||||||
| date: 2018-12-31 | date: 2018-12-31 | ||||||
| lastUpdated: 2019-10-23 | updated: 2019-10-23 | ||||||
| tags: | tags: | ||||||
| - censorship | - censorship | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Firefox Multi-Account Containers | title: Firefox Multi-Account Containers | ||||||
| excerpt: Separate website cookies in a single session | excerpt: Separate website cookies in a single session | ||||||
| date: 2019-08-12 | date: 2019-08-12 | ||||||
| lastUpdated: 2019-08-27 | updated: 2019-08-27 | ||||||
| tags: | tags: | ||||||
| - firefox | - firefox | ||||||
| - privacy | - privacy | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: How to run more than one Firefox instance | title: How to run more than one Firefox instance | ||||||
| excerpt: Using Firefox profiles, you can use more than two instances. | excerpt: Using Firefox profiles, you can use more than two instances. | ||||||
| date: 2019-04-07 | date: 2019-04-07 | ||||||
| lastUpdated: 2019-08-09 | updated: 2019-08-09 | ||||||
| tags: | tags: | ||||||
| - firefox | - firefox | ||||||
| - privacy | - privacy | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Using Git and Git+SSH in GitLab CI | title: Using Git and Git+SSH in GitLab CI | ||||||
| excerpt: Guides and potential pitfalls | excerpt: Guides and potential pitfalls | ||||||
| date: 2019-10-03 | date: 2019-10-03 | ||||||
| lastUpdated: 2020-04-18 | updated: 2020-04-18 | ||||||
| tags: | tags: | ||||||
| - gitlab | - gitlab | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: GNU vs BusyBox Unix tools | title: GNU vs BusyBox Unix tools | ||||||
| excerpt: Alpine uses BusyBox while Ubuntu uses GNU tools, and they behave differently. | excerpt: Alpine uses BusyBox while Ubuntu uses GNU tools, and they behave differently. | ||||||
| date: 2018-10-13 | date: 2018-10-13 | ||||||
| lastUpdated: 2018-10-31 | updated: 2018-10-31 | ||||||
| tags: | tags: | ||||||
| - linux | - linux | ||||||
| - alpine | - alpine | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: How to create a Hexo blog on GitLab Pages | title: How to create a Hexo blog on GitLab Pages | ||||||
| excerpt: Create a website/blog using Hexo on GitLab Pages for free using this detailed guide. | excerpt: Create a website/blog using Hexo on GitLab Pages for free using this detailed guide. | ||||||
| date: 2018-09-21 | date: 2018-09-21 | ||||||
| lastUpdated: 2018-11-10 | updated: 2018-11-10 | ||||||
| tags: | tags: | ||||||
| - hexo | - hexo | ||||||
| - gitlab | - gitlab | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: How to remove Windows 10 default apps | title: How to remove Windows 10 default apps | ||||||
| excerpt: How to get rid of these bloatware. | excerpt: How to get rid of these bloatware. | ||||||
| date: 2018-09-26 | date: 2018-09-26 | ||||||
| lastUpdated: 2019-03-01 | updated: 2019-03-01 | ||||||
| tags: | tags: | ||||||
| - windows | - windows | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: "How to make your website available over I2P Eepsite on NixOS" | title: "How to make your website available over I2P Eepsite on NixOS" | ||||||
| excerpt: "A guide on I2P Eepsite on NixOS" | excerpt: "A guide on I2P Eepsite on NixOS" | ||||||
| date: 2020-03-21 | date: 2020-03-21 | ||||||
| lastUpdated: 2020-04-22 | updated: 2020-04-22 | ||||||
| tags: | tags: | ||||||
| - server | - server | ||||||
| - linux | - linux | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Make Hexo blog smaller | title: Make Hexo blog smaller | ||||||
| excerpt: Static site serves html, css, javascript and images. These files can be compressed to reduce bandwidth and speed up the website. | excerpt: Static site serves html, css, javascript and images. These files can be compressed to reduce bandwidth and speed up the website. | ||||||
| date: 2018-09-28 | date: 2018-09-28 | ||||||
| lastUpdated: 2018-10-06 | updated: 2018-10-06 | ||||||
| tags: | tags: | ||||||
| - hexo | - hexo | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: microG, a replacement for the proprietary Google Play Services | title: microG, a replacement for the proprietary Google Play Services | ||||||
| excerpt: The core of the Android OS is open source, but much of the core apps, libraries and APIs are proprietary. | excerpt: The core of the Android OS is open source, but much of the core apps, libraries and APIs are proprietary. | ||||||
| date: 2019-01-12 | date: 2019-01-12 | ||||||
| lastUpdated: 2019-04-30 | updated: 2019-04-30 | ||||||
| tags: | tags: | ||||||
| - android | - android | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Recommended open-source Android apps | title: Recommended open-source Android apps | ||||||
| excerpt: Apps I'm currently using and recommend to everyone. | excerpt: Apps I'm currently using and recommend to everyone. | ||||||
| date: 2019-01-07 | date: 2019-01-07 | ||||||
| lastUpdated: 2020-04-15 | updated: 2020-04-15 | ||||||
| tags: | tags: | ||||||
| - android | - android | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Secure node modules with Snyk | title: Secure node modules with Snyk | ||||||
| excerpt: The package dependency on Node can cause security issue. Here's how to use Snyk to mitigate it. | excerpt: The package dependency on Node can cause security issue. Here's how to use Snyk to mitigate it. | ||||||
| date: 2018-10-01 | date: 2018-10-01 | ||||||
| lastUpdated: 2019-06-11 | updated: 2019-06-11 | ||||||
| tags: | tags: | ||||||
| - node | - node | ||||||
| - snyk | - snyk | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Snyk failed to patch in Alpine docker | title: Snyk failed to patch in Alpine docker | ||||||
| excerpt: Synk depends on GNU version of patch utility. | excerpt: Synk depends on GNU version of patch utility. | ||||||
| date: 2018-10-31 | date: 2018-10-31 | ||||||
| lastUpdated: 2019-03-09 | updated: 2019-03-09 | ||||||
| tags: | tags: | ||||||
| - snyk | - snyk | ||||||
| - linux | - linux | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: Change spellcheck language in Ghostwriter | title: Change spellcheck language in Ghostwriter | ||||||
| excerpt: It supports Hunspell dictionaries for spellcheck of other languages. | excerpt: It supports Hunspell dictionaries for spellcheck of other languages. | ||||||
| date: 2018-10-14 | date: 2018-10-14 | ||||||
| lastUpdated: 2019-06-06 | updated: 2019-06-06 | ||||||
| tags: | tags: | ||||||
| - markdown | - markdown | ||||||
| --- | --- | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: "How to make your website available over Tor hidden service on NixOS" | title: "How to make your website available over Tor hidden service on NixOS" | ||||||
| excerpt: "A guide on Tor hidden service on NixOS" | excerpt: "A guide on Tor hidden service on NixOS" | ||||||
| date: 2020-03-16 | date: 2020-03-16 | ||||||
| lastUpdated: 2020-04-22 | updated: 2020-04-22 | ||||||
| tags: | tags: | ||||||
| - server | - server | ||||||
| - linux | - linux | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| title: About | title: About | ||||||
| layout: page | layout: page | ||||||
| date: 2019-09-20 | date: 2019-09-20 | ||||||
| lastUpdated: 2020-02-19 | updated: 2020-02-19 | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
| ## Projects | ## Projects | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ | ||||||
|     </div> |     </div> | ||||||
|     <footer class="article-footer"> |     <footer class="article-footer"> | ||||||
|       <ul class="article-meta"> |       <ul class="article-meta"> | ||||||
|     <% if (post.lastUpdated) { %> |     <% if (post.updated) { %> | ||||||
|         <li> |         <li> | ||||||
|           <span class="label"><%= __('date_updated') %>:</span> |           <span class="label"><%= __('date_updated') %>:</span> | ||||||
|             <%- partial('post/updated-date') %> |             <%- partial('post/updated-date') %> | ||||||
|  |  | ||||||
|  | @ -1,3 +1,3 @@ | ||||||
| <%/* User-specified updated date */%> | <%/* User-specified updated date */%> | ||||||
| <%/* default post.updated is (almost) always is the time 'hexo generate' is executed */%> | <%/* default post.updated is (almost) always is the time 'hexo generate' is executed */%> | ||||||
| <time class="dt-updated" datetime="<%= date(post.lastUpdated, 'YYYY-MM-DD[T00:00:00.000Z]') %>" itemprop="dateModified"><%= date(post.lastUpdated, 'D MMM YYYY') %></time> | <time class="dt-updated" datetime="<%= date(post.updated, 'YYYY-MM-DD[T00:00:00.000Z]') %>" itemprop="dateModified"><%= date(post.updated, 'D MMM YYYY') %></time> | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ | ||||||
|   <link href="{{ feed_url | uriencode }}" rel="self"/> |   <link href="{{ feed_url | uriencode }}" rel="self"/> | ||||||
|   {% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %} |   {% if config.feed.hub %}<link href="{{ config.feed.hub | uriencode }}" rel="hub"/>{% endif %} | ||||||
|   <link href="{{ url | uriencode }}"/> |   <link href="{{ url | uriencode }}"/> | ||||||
|   <updated>{{ posts.first().updated.toISOString() }}</updated> |   <updated>{% if posts.first().updated %}{{ posts.first().updated | date }}{% else %}{{ posts.first().date | date }}{% endif %}</updated> | ||||||
|   <id>{{ url | uriencode }}</id> |   <id>{{ url | uriencode }}</id> | ||||||
|   {% if config.author %} |   {% if config.author %} | ||||||
|   <author> |   <author> | ||||||
|  | @ -21,7 +21,7 @@ | ||||||
|     <link href="{{ post.permalink }}"/> |     <link href="{{ post.permalink }}"/> | ||||||
|     <id>{{ post.permalink }}</id> |     <id>{{ post.permalink }}</id> | ||||||
|     <published>{{ post.date.toISOString() }}</published> |     <published>{{ post.date.toISOString() }}</published> | ||||||
|     <updated>{% if post.lastUpdated %}{{ post.lastUpdated | date }}{% else %}{{ post.date | date }}{% endif %}</updated> |     <updated>{% if post.updated %}{{ post.updated | date }}{% else %}{{ post.date | date }}{% endif %}</updated> | ||||||
|     {% if config.feed.content and post.content %} |     {% if config.feed.content and post.content %} | ||||||
|     <content type="html"><![CDATA[{{ post.content | noControlChars | safe }}]]></content> |     <content type="html"><![CDATA[{{ post.content | noControlChars | safe }}]]></content> | ||||||
|     {% endif %} |     {% endif %} | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ | ||||||
| /* | /* | ||||||
| * Modified from the hexo version, | * Modified from the hexo version, | ||||||
| * https://github.com/hexojs/hexo-generator-feed
 | * https://github.com/hexojs/hexo-generator-feed
 | ||||||
| * to use post.lastUpdated and remove timezone | * to remove timezone | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| const { extname } = require('path') | const { extname } = require('path') | ||||||
|  |  | ||||||
|  | @ -38,7 +38,7 @@ function openGraphHelper () { | ||||||
|   const screenshot = '/screenshot/' + prettyUrls(this.path, config.pretty_urls) |   const screenshot = '/screenshot/' + prettyUrls(this.path, config.pretty_urls) | ||||||
|   const siteName = config.title || '' |   const siteName = config.title || '' | ||||||
|   const published = page.date || '' |   const published = page.date || '' | ||||||
|   const updated = page.lastUpdated || '' |   const updated = page.updated || '' | ||||||
|   const language = config.language.replace('-', '_') |   const language = config.language.replace('-', '_') | ||||||
|   let result = '' |   let result = '' | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3,8 +3,8 @@ | ||||||
|   {% for post in posts %} |   {% for post in posts %} | ||||||
|   <url> |   <url> | ||||||
|     <loc>{{ post.permalink }}</loc> |     <loc>{{ post.permalink }}</loc> | ||||||
|     {% if post.lastUpdated() %} |     {% if post.updated %} | ||||||
|     <lastmod>{{ post.lastUpdated() }}</lastmod> |     <lastmod>{{ post.updated }}</lastmod> | ||||||
|     {% elif post.date %} |     {% elif post.date %} | ||||||
|     <lastmod>{{ post.date }}</lastmod> |     <lastmod>{{ post.date }}</lastmod> | ||||||
|     {% endif %} |     {% endif %} | ||||||
|  |  | ||||||
|  | @ -33,10 +33,7 @@ module.exports = function (locals) { | ||||||
|     .map((post) => ({ |     .map((post) => ({ | ||||||
|       ...post, |       ...post, | ||||||
|       date: moment(post.date).format('YYYY-MM-DD[T00:00:00.000Z]'), |       date: moment(post.date).format('YYYY-MM-DD[T00:00:00.000Z]'), | ||||||
|       lastUpdated: () => { |       updated: post.updated ? moment(post.updated).format('YYYY-MM-DD[T00:00:00.000Z]') : false | ||||||
|         if (post.lastUpdated) return moment(post.lastUpdated).format('YYYY-MM-DD[T00:00:00.000Z]') |  | ||||||
|         else return false |  | ||||||
|       } |  | ||||||
|     })) |     })) | ||||||
| 
 | 
 | ||||||
|   // configuration dictionary
 |   // configuration dictionary
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue