๐Ÿ“˜ [GithubPages] Jekyll hydejack submenu์„ค์ • & ํฌ์ŠคํŒ… ๋ฐฉ๋ฒ• - 3

๐Ÿ“˜ [GithubPages] Jekyll hydejack submenu์„ค์ • & ํฌ์ŠคํŒ… ๋ฐฉ๋ฒ• - 3

[GithubPages] Jekyll hydejack submenu์„ค์ • & ํฌ์ŠคํŒ… ๋ฐฉ๋ฒ•


โœ… _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ํŽ˜์ด์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ค์ง€ ๋ชปํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.



# 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ํŒŒ์ผ ์ž‘์„ฑ ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.

![208x107](https://i.imgur.com/jrRjpOH.png)

์„œ๋ธŒ๋ฉ”๋‰ด๋Š” ํด๋”๋ฅผ ๋งŒ๋“ค์–ด์„œ ๊ทธ์•ˆ์— ๋„ฃ์–ด์คฌ์Šต๋‹ˆ๋‹ค.

์•„์ง ๊ธ€์„ ์˜ฌ๋ฆฌ์ง„ ์•Š์•˜์ง€๋งŒ 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 : ์—ฐ๊ด€๋œ ๊ธ€ ๋ชฉ๋ก์„ ์ˆ˜๋™ ์ง€์ •(์ถ”์ฒœ ํฌ์ŠคํŠธ๋กœ ์—ฐ๊ฒฐ)

๐Ÿ“‘ Reference



Pagination


ยฉ 2025. All rights reserved.

Powered by Hydejack v9.2.1