포스트

Jekyll - (Chirpy) Rss Feed 설정 변경

jekyll chirpy 테마를 사용하면 feed.xml 포맷 유형이 다른 rss feed 포맷과 다르다.

jekyll chirpy 테마 사용시 기본 설정 된 포맷

image

많이 보이는 다른 사이트들의 rss feed 포맷

image


기본 설정 된 포맷을 변경하려면  지킬 코드 샘플 사이트를 참고하며 /assets/feed.xml 파일과 /_includes/head.html 파일을 수정해주면 된다!

feed.xml 내용 변경

  1.  지킬 코드 샘플 사이트를 방문하여 feed.xml 파일 내용을 복사한다.
  2. /assets/feed.xml 파일에서 5번째 줄(---) 아래의 코드를 전부 삭제하고 복사한 코드를 붙여 넣는다.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    
    ---  
    layout: compress  
    permalink: /feed.xml  
    # Atom Feed, reference: https://jekyllcodex.org/without-plugin/rss-feed/  
    ---  
    	  
    <?xml version="1.0" encoding="UTF-8"?>  
    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">  
      <channel>    <title>{{ site.title | xml_escape }}</title>  
        <description>{{ site.description | xml_escape }}</description>  
        <link>{{ site.url }}{{ site.baseurl }}/</link>  
        <atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml"/>  
        <pubDate>{{ site.time | date_to_rfc822 }}</pubDate>  
        <lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>  
        <generator>Jekyll v{{ jekyll.version }}</generator>  
        {% for post in site.posts limit:10 %}  
        <item>  
          <title>{{ post.title | xml_escape }}</title>  
          <description>{{ post.content | xml_escape }}</description>  
          <pubDate>{{ post.date | date_to_rfc822 }}</pubDate>  
          <link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link>  
          <guid isPermaLink="true">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid>  
          {% for tag in post.tags %}  
          <category>{{ tag | xml_escape }}</category>  
          {% endfor %}  
          {% for cat in post.categories %}  
          <category>{{ cat | xml_escape }}</category>  
          {% endfor %}  
        </item>  
        {% endfor %}  
      </channel>  
    </rss>
    

head.html 내용 변경

  • /_includes/head.html 파일에 아래 코드를 추가한다.
    1
    2
    
      <!-- Rss -->  
      <link rel="alternate" type="application/rss+xml" href="{{ site.url }}/feed.xml">
    


로컬에서 jekyll 프로젝트를 실행한 후 127.0.0.1:4000/feed.xml 주소로 접근해보면 변경된 것을 확인할 수 있다!
image




참고한 사이트

이 기사는 저작권자의 CC BY 4.0 라이센스를 따릅니다.