2024-08-11 Sunday
今日のhugoさん
本日の作業
- 月別アーカイブ表示できるようにした。手順は以下の通り。基本ググって写経…。
あとでまとめるかも。 -
hugo.toml taxnomy に archives 追加
[taxonomies] tag = "tags" category = "categories" archive = "archives" -
easy-hugo の new post のfront matter に '#+archives: 2024/08' が入るように設定
(leaf easy-hugo :ensure t :init (setq easy-hugo-basedir "~/blog/") (setq easy-hugo-url "https://xxxxxx.netlify.app") (setq easy-hugo-sshdomain "xxxxxt.org") (setq easy-hugo-root "/") (setq easy-hugo-previewtime "300") (setq easy-hugo-postdir "content/posts") (setq easy-hugo-org-header t) (setq easy-hugo-default-ext ".org") ;; Sort-publishday on startup (setq easy-hugo--sort-publishday-flg 1) (setq easy-hugo--sort-char-flg nil) (setq easy-hugo--sort-time-flg nil) (defun my/easy-hugo-newpost (post-file) "easy-hugo-newpost customized version." (interactive (list (read-from-minibuffer "Filename: " `(,easy-hugo-default-ext . 1) nil nil nil))) (let* ((slug (format-time-string "%Y%m%d%H%M")) (new-post-file (concat slug "." post-file))) (easy-hugo-with-env (let ((filename (expand-file-name new-post-file easy-hugo-postdir))) (when (file-exists-p (file-truename filename)) (error "%s already exists!" filename)) (find-file filename) (insert (my/easy-hugo--org-headers (file-name-base post-file) slug)) (goto-char (point-max)) (save-buffer))))) (advice-add 'easy-hugo-newpost :override 'my/easy-hugo-newpost) (defun my/easy-hugo--org-headers (file slug) "Return a draft org mode header string for a new article as FILE." (let ((datetimezone (concat (format-time-string "%Y-%m-%dT%T") (easy-hugo--orgtime-format (format-time-string "%z")))) (year_month (format-time-string "%Y/%m")) ) (concat "#+title: " file "\n#+subtitle: hogemoge diary" "\n#+date: " datetimezone "\n#+publishdate: " datetimezone "\n#+lastmod: " "\n#+slug: " slug "\n#+categories[]: journal" "\n#+tags[]: memo" "\n#+archives: " year_month "\n#+author: @tsut" "\n#+draft: nil" ;; "\n#+toc: false" "\n\n"))) (advice-add 'easy-hugo--org-headers :override 'my/easy-hugo--org-headers) ) - 今までのコンテンツに '#+archives: 2024/08' とかを差し込む
-
サイドバーにアーカイブ表示用のhtmlを作成。~/blog/layouts/partials/widgets/archives
2024-07-29 Monday
今日のあれこれ
- シン・ムサシ vs コメリ。材木の品揃え勝負はムサシの売り場面積勝ち。
- 強風で遮光ネットが保たない問題。経年と日に晒されて弱まってる。とりあえずビニ紐で補強したけど、見た目も大事だし悩。
今日のhugoさん
[news]タグ止めた。毎日ちっとはなにかのnews、だったら付ける意味ないんじゃね?そういう意味では[memo]も要らないが、こっちは自動設定になってる。[news]って手動で付けるのが面倒になった…が本当のところ。
2024-07-27 Saturday
今日のあれこれ
雨雲レーダーに翻弄されて出かけそびれた。オリンピックの開会式観たり、録画番組観たり。
今日のでっち上げ
chromebookで、なんでかeasy-hugo.elが動かない。M-x easy-hugo-newpostできないのは面倒なので、やっつけ仕事った。
# ruby easyHugoNew.rb
# filename
myfilename = "journal.org"
# entryを置く場所
mypath = "~/blog/content/posts"
# 時刻取得
time = Time.now
# タイトル用日付
mytitle = time.strftime("%Y-%m-%d %A")
# ISO8601拡張形式 JST 2024-07-28T22:00:00+09:00
mydate = time.strftime("%Y-%m-%dT%R:%S+09:00")
# format time to slug
myslug = time.strftime( "%Y%m%d%H%M" )
# path+filename
mypost = "#{mypath}/#{myslug}.#{myfilename}"
# fileを作る
file = File.open(File.expand_path(mypost), "w")
# front matter
myheader = <<EOF
,#+title: #{mytitle}
,#+subtitle: hogemoge diary
,#+date: #{mydate}
,#+publishdate: #{mydate}
,#+lastmod:
,#+categories[]: journal
,#+draft: true
,#+tags[]: memo
,#+author: @tsut
,#+slug: #{myslug}
EOF
# front matter を書き込む
file.puts myheader
file.closeどうでしょう?
netlify.toml
Production: main@xxxxxxx Failed
netlifyでhugoのbuildがこけるようになった。apt upgradeで入った手元のhugo v0.128.2とかでエラーや警告がでないよう設定してるうちにnetlyfy上の新しくないhugoではbuildできない設定になってしまった模様。
対策
- 手元のhugoをダウンバージョンする
- netlify上のhugoを手元に合わせる
netlifyをなんとかする方向でググる。netlyfi.tomlでhugoのversionなどの環境を設定できるらしい。
2024-06-25 Tuesday
今日のあれこれ
- 昼休みに本読んでると昼寝できない問題
-
KeePassXC 2.7.9 released – KeePassXC
- note は update した。
今日のhugoさん
- フォントの設定変えてみた(つもり)。変わってない気もする。
- ぐちゃぐちゃになったけど変わった気がする。(どっちじゃねん!)
- もうちょっと整理したらまとめる。
今日のごはん
- 朝: ホットサンド コーヒー
- 昼: ハンバーグ弁当
- 晩: ビビンバ わかめスープ
今日もとりあえず飲まない
故あってしばらく飲まない…(つもり)
hugo_insert_image.rb
画像をリサイズして取ってくるやつその2
require 'rmagick'
require 'date'
require 'fileutils'
require 'optparse'
# gem install clipboard; 要 gem
# sudo apt install xsel; 要 xsel
require 'clipboard'
# default resize 大きさ = 480
mysize = 480
opt = OptionParser.new
opt.on('-r', '--resize VALUE', 'リサイズする大きさ(px)') { |v| mysize = v.to_i }
# opt.on('-t', '--target DIR', '出力先ディレクトリ') { |v| target = v.to_s }
begin
opt.parse(ARGV)
rescue OptionParser::InvalidOption => e
abort "無効なオプション指定が含まれています"
end
# 移動先は /yymmdd/
date_dir = %Q(#{Date.today.strftime("%Y%m%d")})
# target_dir = ~/blog/static/images/yymmdd
target_dir = File.expand_path("~/blog/static/images/#{date_dir}")
# ディレクトリが無ければ作る
FileUtils.mkdir_p(target_dir) unless File.exist?(target_dir)
ARGV.each do |f|
if File.extname(f).downcase =~ /.jpe?g|.png/ then #add .png
img = Magick::ImageList.new(f)
# mysizeより小さい画像は大きくなるのでresizeしない。
img = img.resize_to_fit(mysize, mysize) if [img.rows, img.columns].max > mysize
img = img.auto_orient.strip!
image_file_name = %Q(#{File.basename(f, ".*")}.webp)
img.write(target_dir + "/" + image_file_name)
# Clipboardにshortcodeを入れる 実際の使用には '/*'と'*/'を削除する必要あり
Clipboard.copy(%Q({{< figure src="/images/#{date_dir}/#{image_file_name}" alt="" title="" width="#{img.rows}" height="#{img.columns}" >}}))
# メッセージ
puts %Q[#{Clipboard.paste} が clipboard に入ったよ〜]
end
end変更履歴
2024-10-14 Monday
画像サイズを指定する
2024-06-04 Tuesday
今日の一行ニュース
今日のあれこれ
- 単管パイプとクランプ、ゴミ箱の土台に使ってたやつ、要らねえから持ってくか?だって。とりあえず「はい」って答える。何に使うかは考え中。自分でバラせってよ。
今日のhugoさん
メニューとか付けてみた。どうでしょう?
config.toml
[[Menus.main]]
Name = "トップ"
URL = "/"
weight = 1
[[Menus.main]]
Name = "カテゴリー"
URL = "/categories"
weight = 2
[[Menus.main]]
Name = "タグ"
URL = "/tags"
weight = 3今日のごはん
- 朝: たらこ 油揚げと大根の味噌汁 ひじきの煮物 ご飯 笹団子
- 昼: ゆで卵 ハンバーグ ブロッコリー ひじきの煮物 ご飯
- 晩: ぎす煮物 高野豆腐と根菜の煮物 卵焼き 青菜と油揚げの炒めもの きんぴらごぼう 雲丹のっけご飯
今日もとりあえず飲まない
- 86日目
org-modeでhugoする
hugoを使ってorg-modeをhtmlとかにするってことだが、いまいち良くわからない。画像とかリンクとかをなんとかしたいだけなのにいちいち悩む。調べて、やってみたことを記す。参考は こちら(ショートコード | Hugo)とか。
以下、あまり自信なし。
ショートコード
{{% shortcodename arguments %}}ショートコードネームと引数との区切り(前後も含め)スペース必須
ショートコードをそのまま表示する
2024-06-05 追記
hugoの使い方
hugoでの記事作成
ちょっと訂正
init.el で ↓ のようにしてるから新しいポストは M-x easy-hugo-newpost でおk(たぶん?)
(advice-add 'easy-hugo-newpost :override 'my/easy-hugo-newpost)つーことで
M-x easy-hugoからメニューをたどって [n . . new blog post] ってするってこと。
そらこて、ねっ!
sorakote.net

sorakote.net
レンタルサーバーの引っ越し
- m10.coreserver.jp => v2005.coreserver.jp
ドメイン取得
- バリュードメインで適当に
- sorakote.net とかしてみた
日記のようなものを復旧
- gem 'tdiary-style-emptdiary'をGemfileに追記
- bundle config set path 'vendor/bundle'
- bundle config set --local without 'development'
- bundle install --without development- とりあえず動くことを確認