• SIS Lab
    • >
    • Blog
    • >
    • Octopressに「続きを読む」のプラグイン導入

Octopressに「続きを読む」のプラグイン導入

更新日:2019.04.27 作成日:2013.04.24
Octopressに「続きを読む」のプラグイン導入 https://farm9.staticflickr.com/8390/8678092756_5af15344bf_m.jpg

「続きを読む」ように、記事を折りたたむプラグインを導入。

Octopressなら、/plaginsディレクトリに 以下のpostmore.rbを設定する。

module PostMore
	def postmorefilter(input, url, text)
		if input.include? "
"
			input.split("
").first + "<p class='more'><a href='#{url}'>#{text}</a></p>"
		else
			input
		end
	end
end

Liquid::Template.register_filter(PostMore)

参考

B! Pocket

Related contents

TECH

2013.11.24

Jekyllのバージョンアップ

TECH

2013.05.23

Jekyllのお勉強 -YAML部分と記事本文を分離する正規表現-

TECH

2013.05.20

Sublime Text 2にLiveReloadを導入してMarkdown Previewを快適に!!

TECH

2013.02.03

はてなダイアリーからJekyllへお引越し

TECH

2017.01.08

静的サイトジェネレータ「Hugo」でシンプルブログサイトを構築する

TECH

2015.08.30

JekyllからHugoへの移行ポイント

TECH

2014.12.13

Jekyllのタグとカテゴリを整理するために、一覧表示するWebアプリ(個人用)をつくった

TECH

2014.12.02

Jekyllに月別アーカイブを実装する