diff --git a/_config.yml b/_config.yml index e158fef..6ce4c0f 100644 --- a/_config.yml +++ b/_config.yml @@ -103,3 +103,13 @@ theme: frame ## Docs: https://hexo.io/docs/one-command-deployment deploy: type: '' + +# Sitemap +sitemap: + path: + - sitemap.xml + template: ./sitemap_template.xml + # template_txt: ./sitemap_template.txt + rel: false + tags: true + categories: true \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 160ef0f..39911c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "hexo-generator-archive": "^2.0.0", "hexo-generator-category": "^2.0.0", "hexo-generator-index": "^3.0.0", + "hexo-generator-sitemap": "^3.0.1", "hexo-generator-tag": "^2.0.0", "hexo-renderer-ejs": "^2.0.0", "hexo-renderer-marked": "^6.1.1", @@ -967,6 +968,19 @@ "node": ">=14" } }, + "node_modules/hexo-generator-sitemap": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/hexo-generator-sitemap/-/hexo-generator-sitemap-3.0.1.tgz", + "integrity": "sha512-n+0KLNmq6TLbiZPTQF6NY5MbEem/O+DFx0lgQZNQcU4tdjXIZRrQJs+KRKeT66NTkdlYTqb4WwCxswLqQz0crA==", + "dependencies": { + "hexo-util": "^2.1.0", + "micromatch": "^4.0.2", + "nunjucks": "^3.1.6" + }, + "engines": { + "node": ">=12.13.0" + } + }, "node_modules/hexo-generator-tag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hexo-generator-tag/-/hexo-generator-tag-2.0.0.tgz", @@ -3146,6 +3160,16 @@ "hexo-pagination": "3.0.0" } }, + "hexo-generator-sitemap": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/hexo-generator-sitemap/-/hexo-generator-sitemap-3.0.1.tgz", + "integrity": "sha512-n+0KLNmq6TLbiZPTQF6NY5MbEem/O+DFx0lgQZNQcU4tdjXIZRrQJs+KRKeT66NTkdlYTqb4WwCxswLqQz0crA==", + "requires": { + "hexo-util": "^2.1.0", + "micromatch": "^4.0.2", + "nunjucks": "^3.1.6" + } + }, "hexo-generator-tag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/hexo-generator-tag/-/hexo-generator-tag-2.0.0.tgz", diff --git a/package.json b/package.json index b2495b7..9b14a94 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "hexo-generator-archive": "^2.0.0", "hexo-generator-category": "^2.0.0", "hexo-generator-index": "^3.0.0", + "hexo-generator-sitemap": "^3.0.1", "hexo-generator-tag": "^2.0.0", "hexo-renderer-ejs": "^2.0.0", "hexo-renderer-marked": "^6.1.1", diff --git a/sitemap_template.xml b/sitemap_template.xml new file mode 100644 index 0000000..3563907 --- /dev/null +++ b/sitemap_template.xml @@ -0,0 +1,40 @@ + + + {% for post in posts %} + + {{ post.permalink | uriencode }} + {% if post.updated %} + {{ post.updated | formatDate }} + {% elif post.date %} + {{ post.date | formatDate }} + {% endif %} + monthly + 0.6 + + {% endfor %} + + + {{ config.url | uriencode }} + {{ sNow | formatDate }} + daily + 1.0 + + + {% for tag in tags %} + + {{ tag.permalink | uriencode }} + {{ sNow | formatDate }} + weekly + 0.2 + + {% endfor %} + + {% for cat in categories %} + + {{ cat.permalink | uriencode }} + {{ sNow | formatDate }} + weekly + 0.2 + + {% endfor %} + \ No newline at end of file diff --git a/source/_posts/hello-world.md b/source/_posts/hello-world.md index 6308827..c047796 100644 --- a/source/_posts/hello-world.md +++ b/source/_posts/hello-world.md @@ -1,6 +1,7 @@ --- title: Hello, World date: 2023-09-11 22:00:00 +sitemap: false tags: - murmur --- diff --git a/source/_posts/kktix-banner-generator.md b/source/_posts/kktix-banner-generator.md new file mode 100644 index 0000000..43e4393 --- /dev/null +++ b/source/_posts/kktix-banner-generator.md @@ -0,0 +1,34 @@ +--- +title: KKTIX Banner Generator (活動旗幟產生器) +date: 2023-10-01 11:29:33 +tags: +- dev +- marketing +--- + +在[上次文章](https://hi.rockleon.dev/blog/2023/09/11/visualize-first-try/)中有提到加入了 pydoc 翻譯計畫,在 2023 / 10月舉辦一個實體活動,本次是第一次實際餐與籌備,所以意外的接觸到了 KKTIX 後台。 + +[python-docs-zh-tw](https://github.com/python/python-docs-zh-tw) 翻譯計畫是 [sciwork](https://sciwork.dev/) 社群所支持的專案之一,很多所需的資源都是仰賴 sciwork 的基礎建設而成的,包含這次的售票系統的 KKTIX 也由他們提供。 + +在 KKTIX 的後台中,提供了活動圖片的上傳空間,同時間他也會代表 html meta tag 的圖片,同時意味著,如果在社群媒體平台分享的話,可以有個小縮圖可以看到圖片是甚麼。 + +在社群沒有平面設計師協助的情況之下,小弟我自告奮勇地寫了一個 Banner Generator: + +{% asset_img banner-pydoc.png [banner-pydoc] %} +> [python-docs-zh-tw](https://github.com/python/python-docs-zh-tw) 2023/10 sprint + +Generator 的腳本中,我使用了以下的 techstack (當然是 developed with Python): +1. [Pillow](https://pillow.readthedocs.io/en/stable/): 圖片編輯 +2. [Unsplash API](https://unsplash.com/documentation): 隨機圖片的提供者 + +其中遇到的幾個有趣小東西值得紀錄一下: +1. Unsplash API 取得相片 URL 後,Requests GET 所得到的會直接是 Bytes 而不是 String,原本挖 Stack Overflow 的時候,有看到一個 Reference 指出需要用 StringIO 實作解析圖片, **我被誤導了** ,明明看過相片 URL 本身依定會回傳 Bytes,為甚麼還要用 StringIO 去解析呢?? **(暈頭轉向的我)** +2. 如果是合成透明圖片 (圖層) 的話,一定要用上 ```Image.alpha_composite()```,不然你的圖片會有很精美的方格子出現,也就是大家最喜歡的 png 透明圖層具現化(?) + +{% asset_img code_bytesio.png [code_bytesio] %} +> Using PIL.Image to open ByteIO Binary Image + +{% asset_img code_alphalayer.png [code_alphalayer] %} +> Image.alpha_composite() to composite the image + +以上就是這次的開發小記,之後有公開的 Repository 再更新上來,總計 2 個小時研究及將 PoC 開發完畢,甚是感動。 \ No newline at end of file diff --git a/source/_posts/kktix-banner-generator/banner-pydoc.png b/source/_posts/kktix-banner-generator/banner-pydoc.png new file mode 100644 index 0000000..73231aa Binary files /dev/null and b/source/_posts/kktix-banner-generator/banner-pydoc.png differ diff --git a/source/_posts/kktix-banner-generator/code_alphalayer.png b/source/_posts/kktix-banner-generator/code_alphalayer.png new file mode 100644 index 0000000..feb9858 Binary files /dev/null and b/source/_posts/kktix-banner-generator/code_alphalayer.png differ diff --git a/source/_posts/kktix-banner-generator/code_bytesio.png b/source/_posts/kktix-banner-generator/code_bytesio.png new file mode 100644 index 0000000..970ac8c Binary files /dev/null and b/source/_posts/kktix-banner-generator/code_bytesio.png differ