configyml 변수 추가시의 문제점¶
Google Adsense를 적용하기 위해 google_ad_client
변수를 _config.yml에 적용하였다.
# Set Google Adsense
google_ad_client: ca-pub-2352406350095521
그리고 Debugging을 위하여 post.html 파일에 다음과 같이 하단 부분에 Debug COde를 삽입하였다.
<div class="veryfy_google_ad">
{% if site.google_ad_client == "" %}
{{"There is no google_ad_client"}}
{%else%}
{{"Parameter" }}
{{ site.google_ad_client }}
{%endif%}
{% if site.google_analytics == "" %}
{{"There is no google_analytics"}}
{%else%}
{{ site.google_analytics }}
{%endif%}
</div>
그런데 이것이 잘 동작하지 않았다. {% if site.google_analytics "" %}
문은 정상적으로 동작하였으나 위쪽의 {% if site.google_ad_client "" %}
은 정상적으로 동작하지 못했다.
해결책¶
간단하였다. jekyll serve를 Stop 시키고 다시 시작하였더니 정상적으로 동작한다.
다시말해, _config.yml 에 변수 적용을 하기 위해서는 Jekyll을 껐다가 다시 켜야 적용이 된다.
- _config.yml에 지정된 변수는 site.parameter 의 형식이다.