블로그 운영 - references

3 분 소요

이 블로그는 Jekyll로 만들어져 있습니다.

Install Jekyll

$ sudo apt-get install ruby ruby-dev build-essential
$ echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
$ echo 'export GEM_HOME=$HOME/gems' >> ~/.bashrc
$ echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bashrc
$ source ~/.bashrc
$ gem update
$ gem install jekyll bundler
$ bundle update

Upgrade Jekyll

$ jekyll --version
$ gem list jekyll
$ bundle update jekyll
$ gem update jekyll

Run Jekyll

$ jekyll serve --draft --host 0.0.0.0

References

...
# Analytics
analytics:
  provider               : google-gtag # false (default), "google", "google-universal", "google-gtag", "custom"
  google:
    tracking_id          : UA-111111111-1
...

Type-on-Strap theme

...
 {% include adsense.html %} 
</head>
  • URL을 /:categories/:title/ 형태로 만들기 위해 _config.yml 파일에 아래와 같이 permalink 라인을 추가
...
# PAGINATION
permalink: /:categories/:title/
paginate: 5
paginate_path: "blog/page:num"
...

minimal-mistakes theme

git clone https://github.com/mmistakes/minimal-mistakes.git YourDirectory
cd YourDirectory
rm -rf .editorconfig .gitattributes .github docs/ test/ CHANGELOG.md minimal-mistakes-jekyll.gemspec README.md screenshot-layouts.png screenshot.png    # remove unnecessary files
cat << EOF > Gemfile     # overwrite Gemfile
source "https://rubygems.org"

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!

# gem "github-pages", group: :jekyll_plugins

# To upgrade, run `bundle update`.

gem "jekyll"
gem "minimal-mistakes-jekyll"

# The following plugins are automatically loaded by the theme-gem:
#   gem "jekyll-paginate"
#   gem "jekyll-sitemap"
#   gem "jekyll-gist"
#   gem "jekyll-feed"
#   gem "jekyll-include-cache"
#
# If you have any other plugins, put them here!
group :jekyll_plugins do
end
EOF
bundle install     # install gems then Gemfile.lock is created

Page Redirect (jekyll-redirect-fromn)

Install.

$ vi Gemfile   # add this line
gem "jekyll-redirect-from"
$ bundle

Add the plugin jekyll-redirect-from to your _config.yaml file.

plugins:
  - jekyll-redirect-from

# mimic GitHub Pages with --safe
whitelist:
  - jekyll-redirect-from
^D

Redirect Internally

Add this to your file’s frontmatter.

---
title: Your Post
redirect_from:
  - /old/page/
  - /old2/page2
---

That will create a /old/page/index.html and an /old2/page2 page that redirects to the Your Post page.

Redirect to Other Sites

---
title: Your Post2
redirect_to:
  - https://www.dest.com/
---

That will create a page for Your Post2 to redirect to https://www.supertechcrew.com/.

Search Engine

주요 서치 엔진에 블로그를 등록하면 다른 사람들이 서치를 할 수 있다.

Google

Google Search Console에서 등록한다.

네이버 서치 어드바이저에서 등록한다.

상단의 “웹마스터 도구”를 누르고, 사이트를 입력.

Daum

다음 검색 등록에서 등록한다.

Tips

Notice
{: .notice}

Notice info
{: .notice–info}

Notice Warning
{: .notice–warning}

Notice Danger
{: .notice–danger}

Notice Success
{: .notice–success}

Image click to enlarge (this is caption)

Center aligned text and image
{: .text-center}

image in center ![image in center](/assets/img/triangle.svg){: .align-center}

MacOS에서 설치

Ruby를 설치한다.

$ brew install ruby
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]

Ruby 버전 관리를 위해서 rbenv를 설치한다.

$ brew update
$ brew install rbenv ruby-build  # rbenv, ruby-build 설치
$ eval "$(rbenv init -)"         # .bashrc나 .zshrc에 이 라인을 추가한다.

rbenv를 이용하여 원하는 버전의 ruby를 설치한다. (이 글을 쓰는 시점에서의 최신 버전은 2.7.2)

$ rbenv install 2.7.2
$ rbenv rehash        # 새 Ruby 설치 후 실행합니다.

사용할 ruby의 버전을 지정한다.

$ rbenv global 2.4.4 # 시스템 전역의 버전을 지정
$ rbenv local 2.3.2  # 현재 디렉토리에서 사용할 버전 지정
$ ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]

bundle로 gem을 설치한다.

$ bundle install

참고사이트

https://devinlife.com/howto%20github%20pages/google-search-console-and-analytics/ https://devinlife.com/howto%20github%20pages/register-search-engine/

카테고리: ,

업데이트: