๊ฐ๋ฐ ๋ธ๋ก๊ทธ๋ฅผ ํ๋ค ๋ณด๋, ๊ธ์ด ์์ผ ์๋ก ์นดํ ๊ณ ๋ฆฌ๋ง์ผ๋ก๋ ๋ถํธํ๋ค๊ณ ์๊ฐ์ด ๋ค์๋ค.
๋ฐ๋ผ์ ํน์ ํ๊ทธ(์ฌ์ฉ ์ธ์ด)๋ก ๋ฌถ์ด์ ๋ณด๋ ๊ธฐ๋ฅ์ ๋ง๋ค์ด ๋ณด๋ ค ํ๋ค.
๋ํ, ์ํ์ ํ๊ธฐ๋ ์ถ๊ฐ ๊ธฐ๋ฅ๋ฑ์ ๋ง๋ค์ด ๋ณด๋๋ก ํ๊ฒ ๋ค.
ํ๊ทธ ํํฐ๋ง ๊ธฐ๋ฅ
๋จผ์ ๊ฒ์๊ธ์ [Java], [Python]์ฒ๋ผ ๋ถ๋ฅ ํ๊ทธ๋ฅผ ๋ฌ๊ณ ,
ํ๊ทธ ํด๋ฆญ ์, ํด๋น ๊ธ๋ง ํํฐ๋งํด์ ๋์์ฃผ๋ ๊ฑธ ๋ชฉํ๋ก ํ๋ ค๊ณ ํ๋ค.
๋จผ์ ๋๋ถ๋ฅ์ ์ธ์ด๋ณ/๊ณต๋ถ๋ณ๋ก ์ค์์นญ ๊ธฐ๋ฅ์ ๋ง๋ค๊ณ
function switchTab(type) {
document.querySelectorAll('.tab-item').forEach(tab => tab.classList.remove('active'));
document.getElementById('tab-' + type).classList.add('active');
renderTags(type);
}
์ฌ์ฉํ ํ๊ทธ๋ค๊ณผ, ๋์ ์ผ๋ก ํ๊ทธ๋ค์ ์์ฑ ์ํค๋ ๋ฉ์๋๋ฅผ ๋ง๋ค์๋ค.
const tagGroups = {
lang: ["CSS", "JS", "React", "Spring", "Python", "C#", "Swift", "AppleScript", "MySQL", "Linux", "OS", "etc"],
study: ["์ ๋ณด์ฒ๋ฆฌ๊ธฐ์ฌ", "SQLD", "๋ฆฌ๋
์ค๋ง์คํฐ", "TOEIC", "JLPT"]
};
function renderTags(type) {
const tagContainer = document.querySelector('.main-tags');
if (!tagContainer) return;
tagContainer.innerHTML = tagGroups[type].map(tag =>
`<button class="tag-btn" onclick="filterByTag('${tag}')">${tag}</button>`
).join('');
updateActiveTagStatus();
}
์ด์ , ํ๊ทธ๋ณ๋ก ํด๋นํ๋ ๊ฒ์๊ธ๋ง ๊ฒ์๋๊ฒ ๋ง๋ค์ด ์ฃผ์ด์ผ ํ๋๋ฐ
๋ณดํต ํฐ์คํ ๋ฆฌ์์๋ /search/"๊ฒ์์ด"๋ก ๊ฒ์๊ธ์ ํํฐ๋ง ํด ์ค ์ ์๋ค.

๋ฐ๋ผ์, ํ๊ทธ๋ฅผ ์ ํ ํ์ ๋,
์ผ๋ฐ ํ๊ทธ๋ ํฐ์คํ ๋ฆฌ ๋ด์ฅ ๊ฒ์ ๊ธฐ๋ฅ์ธ /search/ํ๊ทธ๋ช ์ฃผ์๋ฅผ ํ์ฉํ๊ณ ,
๋๊ดํธ๊ฐ ์๋ ๊ธ๋ค์ ๋ชจ์๋ณด๋ ์์ธ ์ผ์ด์ค์ธ etc๋ /category ์ฃผ์์ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ถ์ฌ ๋ถ๊ธฐ ์ฒ๋ฆฌํด์ฃผ์๋ค.
function filterByTag(keyword) {
if (keyword === 'etc') {
window.location.href = window.location.origin + "/category?t_filter=etc";
return;
}
window.location.href = window.location.origin + "/search/" + encodeURIComponent(keyword) + "?t_filter=true";
}
์ด์ด์ ํ์ด์ง๊ฐ ๋ก๋ ๋์์ ๋, t_filter ํ๋ผ๋ฏธํฐ๋ฅผ ํ์ธํ๊ณ
๊ธ ๋ชฉ๋ก์ ์ค์ ๋ก ์์๋ด์ฃผ๋ ๊ธฐ๋ฅ์ ๊ตฌํํ๋ค.
document.addEventListener('DOMContentLoaded', function() {
...
if (filterType) {
postItems.forEach(item => {
const titleElement = item.querySelector('.title, .link_post, strong, h3');
if (!titleElement) return;
const title = titleElement.innerText.trim();
if (isEtcMode) {
if (/\[.*?\]/.test(title)) item.remove();
} else {
const safeKeyword = currentKeyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const regex = new RegExp(`\\[[^\\]]*${safeKeyword}[^\\]]*\\]`, 'i');
if (!regex.test(title)) item.remove();
}
});
...
}
});
css ์์ ์ ํํฐ ์์ญ๊ณผ, ํ๊ทธ ์์ญ์ ๊ตฌ์ฑํ๊ณ
ํฐ์คํ ๋ฆฌ์ ๋ ์ด์์ ํน์ฑ ๋๋ฌธ์ UI๊ฐ ๋ฐ๋ฆฌ๋๊ฑธ ๋ฐฉ์งํ๊ธฐ ์ํด, block์ผ๋ก ๊ณ ์
.custom-filter-wrap {
display: block !important;
position: relative !important;
visibility: visible !important;
opacity: 1 !important;
transform: none !important;
margin: 20px 0 !important;
z-index: 100;
text-align: center;
}
.filter-tag-list {
display: flex !important;
flex-wrap: wrap !important;
gap: 8px !important;
justify-content: center !important;
width: 100% !important;
}
์ธ์ด๋ณ, ๊ณต๋ถ๋ณ ์นดํ ๊ณ ๋ฆฌ ์ ํ์ ์ํ ๋์์ธ ๋ถ๋ถ๋ ๊ตฌํ
.tab-item {
cursor: pointer;
transition: all 0.2s ease;
opacity: 0.4;
}
.tab-item.active {
opacity: 1;
color: #555 !important;
}
.tab-divider {
font-weight: normal;
color: #444;
font-size: 0.8em;
opacity: 0.5;
}
๊ทธ ์ธ์ ๋ฒํผ ๋์์ธ๊ณผ ๋คํฌ๋ชจ๋ ๋์ ์์ ๊น์ง ์๋ฃํ๋ฉด ์์ ์ ๋์ด๋ค.
ํ๊ทธ ์์น๋ ์ธ๊ธฐ ๊ธ ์์ ๋ฐฐ์น ํ๊ณ ,
๋ฏธ๋ฆฌ ๋ง๋ ํ๊ทธ ๋ฆฌ์คํธ์ ๋ง๊ฒ ์ ๋ ฌ๋์ด ๋ฐฐ์น ๋๋ค.

Spring ํ๊ทธ๋ฅผ ๋๋ฅด๋ฉด, ํด๋น ๊ฒ์๊ธ๋ค ํํฐ๋ง๊ณผ,
ํ์ดํ์ ๋๊ดํธ ํ๊ทธ๊ฐ ์์ ๋ ๋์ค๋ ๊ฒ์๊ธ์ ์๋ ํํฐ๋งํด์ ์๋ณด์ด๊ฒ ์ฒ๋ฆฌํ๋ค.

์ํ์ ํ๊ธฐ ๊ธฐ๋ฅ
์ด์ ๊ฐํน, ์ด๋ก ์ค๋ช ์์ ์ํ์์ด ํ์ํ ๋๊ฐ ์๋๋ฐ
์ํ์์ ๊ทธ๋๋ก ํํํ๋ฉด ์ด๋ฐ์์ผ๋ก ์์๋ณด๊ธฐ ํ๋ค๊ฒ ๋์จ๋ค.

๋ฐ๋ผ์, MathJax๋ผ๋ ์ํ์ ๋ ๋๋ง ์ฝ๋๋ฅผ ์ด์ฉํ ๊ฒ์ธ๋ฐ.
$์ฌ์ธ์ผ๋ก ์์์ ๊ฐ์ธ๋ฉด ์ํ ๊ณต์์ผ๋ก ๋ณํ
์ถฉ๋์ ์๋ธ๊ท์น์ ((์์))์ผ๋ก ์ง์ ํ๋ค.
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [['$','$'], ['\((','\))']]
}
});
</script>
์ด์ ์ํ์ ๋ถ์ ๋ฐ ๊ฐ์ํ ์ฐ์ฐ์ ์ง์ ์ ๋ก๋ ํ๊ธฐ์ ๋ฌด๊ฑฐ์ฐ๋ฏ๋ก
CDN์ ์ด์ฉํด์ ์ฒ๋ฆฌ ํ๋ค.
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML"></script>
์ด์๊ฒ ์์์ผ๋ก ๋์ค๋ ๋ชจ์ต

๋ฏธ๋ฆฌ๋ณด๊ธฐ ํํฐ๋ง ๊ธฐ๋ฅ
์ถ๊ฐ๋ก ๊ธฐ๋ฅ์ ๋ง๋ค๋ฉด์ ํ์ํ ๊ฒ์ด ์๊ฐ๋ฌ๋๋ฐ
๊ฒ์๊ธ๋ง๋ค, ์๋ฆฌ์ฆ ๋งํฌ๋ฅผ ์๋จ์ ๋ค๋๊น ๋ฏธ๋ฆฌ๋ณด๊ธฐ๊ฐ ๋งํฌ๋ก ๋ค ๊ฐ๋ ค์ง๊ณ ์์๋ค.
๋ฐ๋ผ์, ๋งํฌ ๋ถ๋ถ์ ์ ๊ฑฐ ํ ํํฐ๋ง์ ๋ง๋ค์ด ๋ณด๋๋ก ํ์.

๋์ ํ๊ฒํ ์ ํ๊ณ , ์ ๊ทํํ์์ ์ด์ฉํด [ํ๊ทธ]-์๋ฆฌ์ฆ๋ช -ํ์ฐจ๋ฒํธ ํํ๋ก ๋งค์นญ
๊ทธ๋ฆฌ๊ณ ๋งค์นญ๋ ํ ์คํธ๋ฅผ ์ ์ ํ์ฌ ๋ณด์ด์ง ์๊ฒ ์ฒ๋ฆฌ๋ฅผ ํ๋ค.
document.addEventListener('DOMContentLoaded', function() {
const postItems = document.querySelectorAll('.post-item, .article-list li, .list-row, .cover-thumbnail-2 li');
postItems.forEach(item => {
const excerptElement = item.querySelector('.excerpt');
if (excerptElement) {
let text = excerptElement.innerText;
const pattern = /\[.*?\]\s*-\s*.*?\s*-\s*\d+/g;
let cleanedText = text.replace(pattern, '').trim();
if (cleanedText.length > 0) {
excerptElement.innerText = cleanedText;
}
}
});
});
์ด์ ๋ถํ์ํ ๋งํฌ๋ ์๋ณด์ด๊ฒ ๋์๋ค.

์ด๋ก์จ, ํ์ํ ์์ ์ ๋ชจ๋ ๋๋ฌ๋ค.
๋น๋ถ๊ฐ์ ์ถ๊ฐ์ ์ธ ๊ธฐ๋ฅ์ ํ์ ์์ด ๋ณด์ฌ์ ์ด๋๋ก ์ค๋ ์ ์งํ์ง ์์๊น ์ถ๋ค.
์๋ณธ ๊ฒ์๊ธ
https://blog.naver.com/101artspace/224338628914
[CSS/JS] ํฐ์คํ ๋ฆฌ ๋ธ๋ก๊ทธ์ ํ๊ทธ ํํฐ๋ง ๋ฐ ์ํ์ ๊ธฐ๋ฅ ์ถ๊ฐํ๊ธฐ
๊ฐ๋ฐ ๋ธ๋ก๊ทธ๋ฅผ ํ๋ค ๋ณด๋, ๊ธ์ด ์์ผ ์๋ก ์นดํ ๊ณ ๋ฆฌ๋ง์ผ๋ก๋ ๋ถํธํ๋ค๊ณ ์๊ฐ์ด ๋ค์๋ค. ๋ฐ๋ผ์ ํน์ ํ๊ทธ(...
blog.naver.com