File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 2
2
< html xmlns ="http://www.w3.org/1999/xhtml "{% if page.vertical-writing %} class ="vertical-writing-recommended "{% endif %} >
3
3
{% include head.html %}
4
4
< body >
5
+ {% renderonceusecache header.html %}
5
6
{% include header.html %}
7
+ {% endrenderonceusecache %}
6
8
< div class ="page-content ">
7
9
< div class ="wrapper ">
8
10
{{ content }}
9
11
</ div >
10
12
</ div >
13
+ {% renderonceusecache footer.html %}
11
14
{% include footer.html %}
15
+ {% endrenderonceusecache %}
12
16
</ body >
13
17
</ html >
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+ module Jekyll
3
+ class RenderOnceUseCacheTag < Liquid ::Block
4
+ @@cache = { }
5
+
6
+ def initialize ( tag_name , text , tokens )
7
+ super
8
+ @text = text
9
+ end
10
+
11
+ def render ( context )
12
+ @@cache [ @text ] = super unless @@cache . include? ( @text )
13
+ @@cache [ @text ]
14
+ end
15
+ end
16
+ end
17
+
18
+ Liquid ::Template . register_tag ( 'renderonceusecache' , Jekyll ::RenderOnceUseCacheTag )
19
+
You can’t perform that action at this time.
0 commit comments