내 첫 번째 Jekyll (버전 4.0.0 사용) 기반 사이트를 만들고 있습니다. 문제는 Front Matter의 변수가 인식되지 않는다는 것입니다.
_includes의 HTML (writing-post-featured-image.html)
<figure>
<img class="feat-img" src="{{ site.baseurl }}/assets/images/{{ include.images }}" alt="{{ include.alt | default: 'lorem ipsum' }}" />
<figcaption>{{ include.caption }}</figcaption>
</figure>
_layout에서 텍스트 기반 게시물 페이지 레이아웃 (writings-post.html)
{% include writing-post-featured-image.html image=post.featured-image alt=post.featured-image-alt %}
마지막으로 .md 파일 (_posts 아래)에서 다음 Front Matter
layout: writings-post
title: my title
permalink: /writings/:title
featured-image: photo.jpg
featured-image-alt: about photo
caption: photo caption
출력이 비어 있습니다.
<figure>
<img class="feat-img" src="" alt="lorem ipsum" />
<figcaption></figcaption>
</figure>
그 이유를 이해하도록 도와주세요. 미리 감사드립니다.
구문이 올바르지 않습니다.
1.) 페이지에서 전달하는 변수로서 포함 태그는 다음과 같아야합니다.
{% include writing-post-featured-image.html
image=page.featured-image
alt=page.featured-image-alt
caption=page.caption %}
2.) 당신은 포함 해야하는 구문 문제 include.images
가 있습니다 include.image
.
참고 : 기존 변수 (계산 된 변수가 아님)를 전달할 때 포함 내에서 페이지의 변수를 볼 수 있으므로 포함으로 전달하는 것을 건너 뛸 수 있습니다.
{% include writing-post-featured-image.html %}
그리고 당신의 포함 :
<figure>
<img class="feat-img"
src="{{ site.baseurl }}/assets/images/{{ page.featured-image }}"
alt="{{ page.featured-image | default: 'lorem ipsum' }}" />
<figcaption>{{ page.caption }}</figcaption>
</figure>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다