File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ const data = {
1212 orgName : 'Node.js 日本ユーザーグループ' ,
1313 pages : require ( './pages' ) ,
1414 layoutDir : path . join ( __dirname , 'source/layout' ) ,
15- basepath : process . env . BASEPATH || ''
15+ // file を受け取って root への相対パスを返す関数
16+ basepath : file => path . dirname ( path . relative ( file . relative , '' ) )
1617}
1718
1819require ( 'nunjucks' ) . configure ( ) . addFilter ( 'date' , require ( 'nunjucks-date' ) )
Original file line number Diff line number Diff line change 55
66 {% for event in file .files %}
77 <hr />
8- <h2 ><a href =" {{ basepath }}/{{ event.relative }}" >{{ event .fm .name }} </a ></h2 >
8+ <h2 ><a href =" {{ basepath(file) }}/{{ event.relative }}" >{{ event .fm .name }} </a ></h2 >
99 <p >日時:
1010 {% for date in event .fm .date %}
1111 {% if not loop .first %}
1414 {{ date | date (' YYYY年MM月DD日' ) }}
1515 {% endfor %}
1616 {% if event .fm .image %}
17- <p ><a href =" {{ basepath }}{{ event.relative }}" ><img src =" {{ event.fm.image }}" /></a ></p >
17+ <p ><a href =" {{ basepath(file) }}{{ event.relative }}" ><img src =" {{ event.fm.image }}" /></a ></p >
1818 {% endif %}
1919 </ul >
2020 {% endfor %}
Original file line number Diff line number Diff line change 55 <hr />
66 {% if file .fm .image %}
77 {% if file .fm .site %}
8- <a href =" {{ file.fm.site.url }}" ><img src =" {{ basepath }}/{{ file.fm.image }}" /></a >
8+ <a href =" {{ file.fm.site.url }}" ><img src =" {{ basepath(file) }}/{{ file.fm.image }}" /></a >
99 {% else %}
10- <img src =" {{ basepath }}/{{ file.fm.image }}" />
10+ <img src =" {{ basepath(file) }}/{{ file.fm.image }}" />
1111 {% endif %}
1212 <br />
1313 <br />
Original file line number Diff line number Diff line change 44<h1 >{{ file .fm .name }} </h1 >
55{% if file .fm .image %}
66 <a href =" {{ file.fm.url }}" >
7- <img src =" {{ basepath }}/{{ file.fm.image }}" width =" 165" style =" margin : 15px ;" />
7+ <img src =" {{ basepath(file) }}/{{ file.fm.image }}" width =" 165" style =" margin : 15px ;" />
88 </a >
99{% endif %}
1010{% if file .fm .role %}
Original file line number Diff line number Diff line change 55
66{% for file in file .files %}
77<hr />
8- <h2 ><a href =" {{ basepath }}/{{ file.relative }}" >{{ file .fm .name }} </a ></h2 >
8+ <h2 ><a href =" {{ basepath(file) }}/{{ file.relative }}" >{{ file .fm .name }} </a ></h2 >
99{% if file .fm .image %}
10- <p ><img src =" {{ basepath }}/{{ file.fm.image }}" width =" 120" style =" margin : 15px ;" ></p >
10+ <p ><img src =" {{ basepath(file) }}/{{ file.fm.image }}" width =" 120" style =" margin : 15px ;" ></p >
1111{% endif %}
1212<p >
1313{% if file .fm .role %}
Original file line number Diff line number Diff line change 11<title >{{ orgName }} </title >
22<meta charset =" UTF-8" >
33<meta name =" viewport" content =" width=device-width, initial-scale=1" >
4- <link rel =" stylesheet" href =" {{ basepath }}/css/tacit.min.css" />
5- <link rel =" stylesheet" href =" {{ basepath }}/css/style.css" />
6- <link rel =" icon" href =" {{ basepath }}/images/favicon.png" />
4+ <link rel =" stylesheet" href =" {{ basepath(file) }}/css/tacit.min.css" />
5+ <link rel =" stylesheet" href =" {{ basepath(file) }}/css/style.css" />
6+ <link rel =" icon" href =" {{ basepath(file) }}/images/favicon.png" />
77
88<nav >
9- <img width =" 150" src =" {{ basepath }}/images/nodejs-logo.svg" />
9+ <img width =" 150" src =" {{ basepath(file) }}/images/nodejs-logo.svg" />
1010<br />
1111<ul >
1212{% for page in pages %}
1313 {% if page .path == file .relative %}
1414 <li >{{ page .name }}
1515 {% else %}
16- <li ><a href =" {{ basepath }}/{{ page.path }}" >{{ page .name }} </a >
16+ <li ><a href =" {{ basepath(file) }}/{{ page.path }}" >{{ page .name }} </a >
1717 {% endif %}
1818{% endfor %}
1919</ul >
Original file line number Diff line number Diff line change 77<hr />
88<h2 >
99 <small >{{ file .fm .date | date (' YYYY/MM/DD' ) }} </small >
10- <a href =" {{ basepath }}/{{ file.relative }}" >{{ file .fm .title }} </a >
10+ <a href =" {{ basepath(file) }}/{{ file.relative }}" >{{ file .fm .title }} </a >
1111</h2 >
1212{% endfor %}
1313
You can’t perform that action at this time.
0 commit comments