Share
Embed
スライドファイルをセルフホスト(Pelican利用)
source: https://gitlab.com/matoken/koedolug-2022.06/-/blob/main/slide/slide.adoc
発表: 小江戸らぐ 6月のオフな集まり(第239回) https://koedolug.connpass.com/event/248209/
Kenichiro MATOHARA
June 11, 2022
Transcript
29 slides
-
セルフホスト セルフホスト WordPress / その後公開リンクが消えているのに気づいて悲しみ 後のことを考えるとcpするだけで移行できる静的な仕組みにしたい pdfファイル置くだけだと探しにくい html手書きは面倒 軽量マークアップ言語で書いてPandocなどで変換はファイル管理が 面倒
静的サイトジェネレーター Wiki 「小江戸らぐ 4月のオフな集まり(第225回)」にて「Nextcloudでス ライドをウェブに埋め込みたい」 8 / 29 -
探す 探す [1] 導入が楽(Debian pkgがあったりシングルバイナリだったり), Asciidocで書きたい……殆どない? 1. 更新止まってる? awesome-selfhosted/awesome-selfhosted: A
list of Free Software network services and web applications which can be hosted on your own servers Static Site Generators Static Site Generators - Top Open Source SSGs | Jamstack 10 / 29 -
Pelican Pelican 老舗のSSG Pyton製, AGPL-3.0 ライセンス reStructuredText,Markdownで書ける plugin追加でAsciidocでも書ける! Debian pkgあり
https://getpelican.com/ https://getpelican.com/ 11 / 29 -
package version package version [ [1 1] ] 1. $
rmadison -u debian,ubuntu pelican debian: pelican | 3.4.0-2 | oldoldoldstable | source pelican | 3.7.1-1 | oldoldstable | source, all pelican | 4.0.1+dfsg-1 | oldstable | source, all pelican | 4.0.1+dfsg-1.1 | stable | source, all pelican | 4.7.1+dfsg-2 | testing | source, all pelican | 4.7.1+dfsg-2 | unstable | source, all ubuntu: pelican | 3.3-1 | trusty/universe | source pelican | 3.6.3-1 | xenial/universe | source, all pelican | 3.7.1+dfsg-1 | bionic/universe | source, all pelican | 4.0.1+dfsg-1 | focal/universe | source, all pelican | 4.0.1+dfsg-1.1 | impish/universe | source, all pelican | 4.7.1+dfsg-2build1 | jammy/universe | source, all pelican | 4.7.1+dfsg-2build1 | kinetic/universe | source, all Pelican 最新は 4.7.2 13 / 29 -
パッケージを導入するだけ パッケージを導入するだけ 最新(4.7.2)が使いたい場合は pip install pelican $ sudo apt
install pelican $ pelican --version 4.7.1 14 / 29 -
pelican-quickstartで初期設定 pelican-quickstartで初期設定 pelican-quickstart のいくつかの質問に答えてテンプレートが作ら れる,後でファイルを修正して変更できる. $ mkdir pelican_blog && cd
pelican_blog $ pelican-quickstart : > Where do you want to create your new web site? [.] > What will be the title of this web site? slide > Who will be the author of this web site? matoken > What will be the default language of this web site? [ja] > Do you want to specify a URL prefix? e.g., https://example.com (Y/n) n > Do you want to enable article pagination? (Y/n) > How many articles per page do you want? [10] 9 > What is your time zone? [Asia/Tokyo] > Do you want to generate a tasks.py/Makefile to automate generation and publishing? (Y/n) > Do you want to upload your website using FTP? (y/N) > Do you want to upload your website using SSH? (y/N) > Do you want to upload your website using Dropbox? (y/N) > Do you want to upload your website using S3? (y/N) > Do you want to upload your website using Rackspace Cloud Files? (y/N) > Do you want to upload your website using GitHub Pages? (y/N) Done. Your new project is available at /tmp/pelican_blog $ ls -Ap Makefile content/ output/ pelicanconf.py publishconf.py tasks.py 15 / 29 -
Asciidocを使うためにplugin導入 Asciidocを使うためにplugin導入 (option) (option) pluginを適当な場所にclone pelican-quickstartで生成されたpelicanconf.pyに以下を追記 $ git clone --recursive
https://github.com/getpelican/pelican-plugins PLUGIN_PATHS = ['/home/matoken/src/pelican-plugins'] PLUGINS = ['asciidoc_reader'] 16 / 29 -
Asciidocの導入(option) Asciidocの導入(option) or 後者の場合 pelicanconf.py に ASCIIDOC_CMD = "asciidoctor"
を追記 $ sudo apt install asciidoc vim-asciidoc $ sudo apt install asciidoctor vim-asciidoc 17 / 29 -
記事を書いてみる(Asciidoc) 記事を書いてみる(Asciidoc) content/ 以下のファイルが記事として扱われる content/test.adoc = My super title :date:
2022-06-09 17:46 :modified: 2022-06-09 17:46 :tags: thats, awesome :category: yeah :slug: my-super-post :authors: matoken :summary: Short version for index and feeds == title level 2 and so on... 18 / 29 -
記事変換 記事変換 1 htmlコンテンツに変換 2 動作確認用httpdを起動 3 別マシンで確認したいときのhttpd 4 ウェブブラウザで動作確認
$ make html $ make serve $ make serve-global $ xdg-open http://localhost:8080/ 1 2 3 4 19 / 29 -
テーマ変更 テーマ変更 で好みのテーマを探してダウ ンロードする 今回は を利用 pelican-quickstartで生成されたpelicanconf.pyにTHEMEの PATHを追記 次回の make
html から反映される. http://www.pelicanthemes.com/ photowall THEME = "/home/matoken/src/pelican-themes/photowall" 22 / 29 -
イベント情報とかコピペするの イベント情報とかコピペするの 面倒 面倒 タイトル,スライドpdfファイル,connpass IDを指定して実行すると雛形を作ってくれる テンプレートscriptを用意 $ bash ./connpass.sh
Usage: ./connpass.sh TITLE SLIDEFILE [CONNPASSID] $ bash ./connpass.sh "Raspberry Pi Zeroをストレージ無しで活用" content/images/koedolug-2022.05.pdf = Raspberry Pi Zeroをストレージ無しで活用 :date: 2022-05-14 14:00 :modified: 2022-05-14 14:00 :tags: slide, koedolug :category: slide :slug: :authors: matoken :summary: :thumbnail: koedolug-2022.05.jpg image:images/koedolug-2022.05.jpg[] link:images/koedolug-2022.05.pdf[pdf] == 小江戸らぐ 5月のオフな集まり(第238回) 日時:: 2022-05-14 14:00 ~ 2022-05-14 20:00 場所:: オンライン 23 / 29 -
後は適当な場所にUploadすれば 後は適当な場所にUploadすれば OK OK output 以下を upload 1GB以下なら / /
等 $ rsync -avcP output/ remore:~/public_html/slide GitHub Pages GitLab Pages Neocities $ du -hs . 1.8G . 26 / 29 -
まとめ まとめ スライドの公開 SlideShare → SkeakerDeck → Pelican 自分で管理する必要があるけどそこまで面倒でもない? 引っ越しもかんたん(なはず)
アクセスカウンタ,サムネイル,textも欲しい 27 / 29 -
奥付 奥付 発表 発表者 利用ソフトウェア ライセンス 小江戸らぐ 6月のオフな集まり(第239回) Kenichiro Matohara(matoken)
Asciidoctor Reveal.js CC BY 4.0 29 / 29