๐ [GithubPages] Jekyll hydejack submenu์ค์ & ํฌ์คํ ๋ฐฉ๋ฒ - 3
![๐ [GithubPages] Jekyll hydejack submenu์ค์ & ํฌ์คํ
๋ฐฉ๋ฒ - 3](/assets/img/thumbnail/githubpages-thumbnail.png)
[GithubPages] Jekyll hydejack submenu์ค์ & ํฌ์คํ ๋ฐฉ๋ฒ
- โ
_config.yml
๋ฉ๋ด ์ค์ - โ
assets/js/sidebar-folder.js
์์ฑ - โ
_includes/body/nav.html
- โ
_includes/my-head.html
- โ
_sass/my-style.css
- โ
_featured_categories
ํด๋ ์์.md
ํ์ผ ์์ฑ - ๐ ํฌ์คํ ์์ฑ์์
- ๐ Reference
โ
_config.yml
๋ฉ๋ด ์ค์
ํ์ฌ๋ ๋จ์ผ ์นดํ ๊ณ ๋ฆฌ๋ง ์์ฑ๋์ด ์๋๋ฐ ์ฃผ ์นดํ ๊ณ ๋ฆฌ ์๋์ ์๋ธ ์นดํ ๊ณ ๋ฆฌ๋ฅผ ๋ณด์ฌ์ฃผ๋๋ก ๋ง๋ค์ด ๋ณด๋ ค๊ณ ํฉ๋๋ค.
# file: `_config.yml`
# Add links to the sidebar.
menu:
- title: Dev
url: /dev/
submenu:
- title: Spring
url: /spring/
- title: React
url: /react/
- title: Study
url: /study/
submenu:
- title: Algorithm
url: /algorithm/
- title: DataStructure
url: /ds/
- title: ETC
url: /etc/
- title: Documentation
url: /docs/
- title: About
url: /about/
==config.yml ์นดํ ๊ณ ๋ฆฌ ๋ฉ๋ด๋ฅผ ์ค์ ํด์ฃผ์.== ==๋๋ ์ฃผ ์นดํ ๊ณ ๋ฆฌ์==
- ==Dev -> ์๋ธ ์นดํ ๊ณ ๋ฆฌ์ Spring, React==
- ==Study -> ์๋ธ ์นดํ ๊ณ ๋ฆฌ์ Algorithm, DataStructure, ETC== ==๋ฉ๋ด๋ฅผ ์ค์ ํ๋ค. sangmin2ya ๋ ๋ธ๋ก๊ทธ๋ฅผ ์ฐธ๊ณ ํ์ฌ ๋ง๋ค์๋ค.==
โ
assets/js/sidebar-folder.js
์์ฑ
# file: `_config.yml`
function spread(count){
document.getElementById('folder-checkbox-' + count).checked =
!document.getElementById('folder-checkbox-' + count).checked
document.getElementById('spread-icon-' + count).innerHTML =
document.getElementById('spread-icon-' + count).innerHTML == 'arrow_drop_down' ?
'arrow_right' : 'arrow_drop_down'
}
๋ฉ๋ด ์์ชฝ ํ์ดํ๋ฅผ ํด๋ฆญํ๋ฉด ๋์ํ๋ spread function์ ์์ฑํ๋ค.
โ
_includes/body/nav.html
# file: `_includes/body/nav.html`
<span class="sr-only">{{ site.data.strings.navigation | default:"Navigation" }}{{ site.data.strings.colon | default:":" }}</span>
<ul>
{% if site.menu %}
{% for node in site.menu %}
{% assign url = node.url | default: node.href %}
{% assign count = count | plus: 1 %}
<li>
<div class="menu-wrapper">
{% if node.submenu %}
<button class="spread-btn" onclick="javascript:spread({{count}})">
<span id="spread-icon-{{count}}" class="material-icons">arrow_drop_down</span>
<!-- arrow_right -->
</button>
{% endif %}
<a
{% if forloop.first %}id="_drawer--opened"{% endif %}
href="{% include_cached smart-url url=url %}"
class="sidebar-nav-item {% if node.external %}external{% endif %}"
{% if node.rel %}rel="{{ node.rel }}"{% endif %}
>
{{ node.name | default:node.title }}
</a>
</div>
{% if node.submenu %}
<div class="menu-wrapper">
<input type="checkbox" id="folder-checkbox-{{count}}" checked>
<ul>
{% for subnode in node.submenu %}
<li>
<a
class="sidebar-nav-item {% if node.external %}external{% endif %}"
href="{% include_cached smart-url url=subnode.url %}"
>
{{ subnode.title }}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
</li>
{% endfor %}
{% else %}
{% assign pages = site.pages | where: "menu", true %}
{% assign documents = site.documents | where: "menu", true %}
{% assign nodes = pages | concat: documents | sort: "order" %}
{% for node in nodes %}
{% unless node.redirect_to %}
<li>
<a
{% if forloop.first %}id="_navigation"{% endif %}
href="{{ node.url | relative_url }}"
class="sidebar-nav-item"
{% if node.rel %}rel="{{ node.rel }}"{% endif %}
>
{{ node.title }}
</a>
</li>
{% else %}
<li>
<a href="{{ node.redirect_to }}" class="sidebar-nav-item external">{{ node.title }}</a>
</li>
{% endunless %}
{% endfor %}
{% endif %}
</ul>
if๋ฌธ ์ถ๊ฐ submenu๊ฐ ์์๋ ํ์ดํ ๋ฒํผ์ ์ถ๊ฐํด์ฃผ๊ณ ๋ฒํผ ํด๋ฆญ์ onclick : spread ํจ์ํธ์ถ ํ๋๋ก ์ถ๊ฐํด์ค๋ค.
โ
_includes/my-head.html
# file:`_includes/my-hdad.html`
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="/assets/js/sidebar-folder.js"></script>
font์ถ๊ฐ์ sidebar-folder.js๊ฐ ๋์ํ๋๋ก ์ถ๊ฐํด์ค๋ค.
โ
_sass/my-style.css
# file: `_sass/my-style.css`
.sidebar-sticky {
height: 100%;
padding-top: 5%;
position: absolute;
}
.sidebar-about {
padding-bottom:10%;
}
.spread-btn{
left: 7%;
position: absolute;
padding: 0;
padding-top: 5px;
border: none;
background: none;
color: white;
cursor: pointer;
}
.spread-btn:hover{
color: grey;
}
.menu-wrapper{
display: flex;
text-align: left;
margin-left: 10%;
margin-bottom: 0%;
input[type=checkbox]{
display: none;
}
input[type=checkbox] ~ ul{
display: none;
list-style: none;
}
input[type=checkbox]:checked ~ ul{
display: block;
}
}
submenu ๋ฒํผ css ์ถ๊ฐํด์ค๋ค.
??? โน๏ธ์ฌ์ด๋๋ฐ์ ๋ฉ๋ด๋ ๋ง๋ค์๋๋ฐ ํด๋ฆญ์ ํ๋ฉด 404 ์๋ฌ๊ฐ ๋๋ค. ๊ทธ ์ด์ ๋ listํ์ด์ง๋ฅผ ๋ถ๋ฌ์ค์ง ๋ชปํ๊ธฐ ๋๋ฌธ์ด๋ค.
โ
_featured_categories
ํด๋ ์์ .md
ํ์ผ ์์ฑ
# file: `study.md`
---
layout: list
type: category
title: Study
sitemap: true
hide_description: false
order: 2
description: >
๊ณต๋ถํ๋ฉฐ ์๊ธด์ผ
---
# file: `etc.md`
---
layout: list
category: study
title: etc
description: >
about ETC
list: true
order: 2
---
์ฃผ ๋ฉ๋ด์ ์๋ธ ๋ฉ๋ด .mdํ์ผ ์์ฑ ์์์ ๋๋ค.
 |
์๋ธ๋ฉ๋ด๋ ํด๋๋ฅผ ๋ง๋ค์ด์ ๊ทธ์์ ๋ฃ์ด์คฌ์ต๋๋ค.
์์ง ๊ธ์ ์ฌ๋ฆฌ์ง ์์์ง๋ง list ํ์ด์ง๋ก ์ด๋ํ๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค.
๐ ํฌ์คํ ์์ฑ์์
์ด์ ์นดํ ๊ณ ๋ฆฌ๋ณ ํฌ์คํ ์์ฑ๋ฒ์ ๋ํด ์ค๋ช ํ๊ฒ ์ต๋๋ค.!
==_posts ํด๋๋ฅผ ์์ฑํ๊ณ .mdํ์ผ์ ์์ฑํ์ฌ== ==ํ์ผ๋ช ์ yyyy-mm-dd-[์ ๋ชฉ].md ํฌ๋ฉง์ ๊ธฐ๋ณธ ์์ฑํด์ฃผ์๋ฉด ๋ฉ๋๋ค.==
# file: `์์ฑ์์`
---
layout: post
title: ๐ Git ๋ช
๋ น์ด ์ ๋ฆฌ
image:
path: /assets/img/blog/example-content-iii.jpg
categories: [study, etc]
tags: [git]
description: >
Git ๋ช
๋ น์ด ์ ๋ฆฌ
published: true
sitemap: true
related_posts: _posts/study/etc/2025-05-01-git-basic.md
---
layout
:post
์ด ๊ธ์ด ํฌ์คํธ ํ์์ด๋ผ๋ ๊ฒ์ ์ง์ title
: ๊ธ ์ ๋ชฉ ์ง์ image
: ํฌ์คํ ์ธ๋ค์ผ ์ด๋ฏธ์ง ๊ฒฝ๋กcategories
: ์นดํ ๊ณ ๋ฆฌ ์ง์ (๋๋ถ๋ฅ, ์๋ถ๋ฅ)tags
: ํ๊ทธ ๋ชฉ๋กdescription
: ๊ธ ์์ฝ ์ค๋ช (๊ฒ์์์ง ์์ฝ์ผ๋ก ๋ ธ์ถ๋จ)sitemap
: ์ฌ์ดํธ๋งต์ ํฌํจํ ์ง ์ฌ๋ถ(true
๋ฉดsitemap.xml
์ ํฌํจ๋์ด ๊ฒ์์์ง ์์ธ ๊ฐ๋ฅ)related_posts
: ์ฐ๊ด๋ ๊ธ ๋ชฉ๋ก์ ์๋ ์ง์ (์ถ์ฒ ํฌ์คํธ๋ก ์ฐ๊ฒฐ)