Home [Jekyll] Plugins
Post
Cancel

[Jekyll] Plugins

SEO tag 추가

  • https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/installation.md
  • https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md

Gemfile에 아래와 같이 추가

1
gem 'jekyll-seo-tag'

_config.yaml에 아래와 같이 추가

1
2
plugins:
  - jekyll-seo-tag

Jekyll 버전이 3.5.0 이하라면 plugins대신 gem을 사용

_site/index.html에 아래 코드를 </head> 전에 추가

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!-- Begin Jekyll SEO tag v2.8.0 -->
<title>[Jekyll] Plugins | restatos memo</title>
<meta name="generator" content="Jekyll v4.3.2" />
<meta property="og:title" content="[Jekyll] Plugins" />
<meta property="og:locale" content="en" />
<meta name="description" content="SEO tag 추가" />
<meta property="og:description" content="SEO tag 추가" />
<link rel="canonical" href="/posts/jekyll-plugins/" />
<meta property="og:url" content="/posts/jekyll-plugins/" />
<meta property="og:site_name" content="restato’s memo" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2021-07-03T00:00:00+09:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="[Jekyll] Plugins" />
<meta name="twitter:site" content="@direcision" />
<meta name="google-site-verification" content="0GLTtjarMTr8NsaJaP-z0tbHPycvu_rOoQykr81BL0o" />
<script type="application/ld+json">
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2021-07-03T00:00:00+09:00","datePublished":"2021-07-03T00:00:00+09:00","description":"SEO tag 추가","headline":"[Jekyll] Plugins","mainEntityOfPage":{"@type":"WebPage","@id":"/posts/jekyll-plugins/"},"url":"/posts/jekyll-plugins/"}</script>
<!-- End Jekyll SEO tag -->

1
2
3
4
5
title - The title of the post, page, or document
description - A short description of the page's content
image - URL to an image associated with the post, page, or document (e.g., /assets/page-pic.jpg)
author - Page-, post-, or document-specific author information (see Advanced usage)
locale - Page-, post-, or document-specific locale information. Takes priority over existing front matter attribute lang.

Sitemap

  • https://github.com/jekyll/jekyll-sitemap

Gemfile에 아래와 같이 추가

1
gem 'jekyll-sitemap'

_config.yaml에 아래와 같이 추가

1
2
3
url: "https://example.com" # the base hostname & protocol for your site
plugins:
  - jekyll-sitemap

https://example.com/sitemap.xml을 접속해서 sitemap이 생성되었는지 확인

Gist

  • https://github.com/jekyll/jekyll-gist

gist에 있는 코드를 추가하기 위해서 사용

Gemfile에 아래와 같이 추가

1
gem 'jekyll-gist'

_config.yaml에 아래와 같이 추가

1
2
plugins:
  - jekyll-gist

Analytics

  • (동작안함) ~https://github.com/hendrikschneider/jekyll-analytics~
  • (동작안함) ~https://github.com/ap-automator/jekyll-rushed-analytics~
  • https://jekyllrb.com/docs/step-by-step/04-layouts/
  • https://michaelsoolee.com/google-analytics-jekyll/

_layouts/default.html에 아래와 같이 추가

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
<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>[Jekyll] Plugins</title>
    <!--
  The GA snippet
-->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer src="https://www.googletagmanager.com/gtag/js?id=G-CJKYE91FQM"></script>
<script>
  document.addEventListener("DOMContentLoaded", function(event) {
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}

    gtag('js', new Date());
    gtag('config', 'G-CJKYE91FQM');
  });
</script>

  </head>
  <body>
    ...
  </body>
</html>

_config.yaml에 아래와 같이 추가

1
google_analytics: G-XXXXXXX

_includes/google-analytics.html 추가

1
2
3
4
5
6
7
8
<script async src="https://www.googletagmanager.com/gtag/js?id={"id"=>"G-CJKYE91FQM", "pv"=>{"proxy_endpoint"=>nil, "cache_path"=>nil}}"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', '{"id"=>"G-CJKYE91FQM", "pv"=>{"proxy_endpoint"=>nil, "cache_path"=>nil}}');
</script>

성공!

This post is licensed under CC BY 4.0 by the author.

Jekyll Create Posts

나만의 블로그 만들기