Skip to content

Commit

Permalink
(core/wiki) Add vim.kr advertisement for each vim-related documents
Browse files Browse the repository at this point in the history
  • Loading branch information
malkoG committed Nov 8, 2023
1 parent 87ac4d0 commit 3e0f1b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/_components/vim_kr_advertisement.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

<pre class="mx-0 md:mx-8 mb-8 rounded-xl py-6 px-6 bg-lime-100 text-gray-900 overflow-visible break-words"><div class="flex flex-col md:flex-row justify-start items-start md:items-center"><i class="bi w-16 text-4xl mb-2 md:mb-0 bi-info-circle font-extrabold"></i><p class="m-0 p-0">혹시 이 글을 읽고 Vim에 관심을 가지게 되셨나요?<br/>Vim에 관심있는 사람들을 위한 Discord 커뮤니티 <br/><a href="https://vim.kr">vim.kr</a> 바로 여러분들을 위한 커뮤니티입니다.</p></div></pre>

16 changes: 11 additions & 5 deletions src/_layouts/wiki.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ layout: default
</div>

<article id="wiki-content">
{% if resource.data.tags contains "vim" %}
{% render "vim_kr_advertisement" %}
{% endif %}

{{ content }}
</article>

Expand All @@ -37,6 +41,7 @@ layout: default
<div class="text-center my-4">
<a class="bmc-button" target="_blank" href="https://qr.kakaopay.com/Ej8T6e8CM5dc06009"><img src="https://www.buymeacoffee.com/assets/img/BMC-btn-logo.svg" alt="Buy me a coffee"><span style="margin-left:5px">Buy me a coffee</span></a>
</div>

<script src="https://utteranc.es/client.js"
repo="kodingwarrior/kodingwarrior.github.io"
issue-term="title"
Expand All @@ -45,12 +50,13 @@ layout: default
async>
</script>


<script>
window.addEventListener("load", function(event) {
const target = document.querySelector('#wiki-content')
const before = target.innerHTML
const results = [...before.matchAll(/\[\[([\w\s\/\.\-\_]*)\]\](\{.*\})?/g)]
let after = before
results.forEach(function(result) {
const anchorHtml = result[2] !== undefined ? '<a href="/wiki/' + result[1] + '">' + result[2].slice(1, -1) + '</a>' : '<a href="/wiki/' + result[1] + '">' + result[1] + '</a>';
Expand Down Expand Up @@ -118,7 +124,7 @@ window.addEventListener("load", function(event) {
if (element.href.includes("github.com")) {
element.prepend(githubIcon.cloneNode(true))
}
// wikipedia
if (element.href.includes("wikipedia.org")) {
element.prepend(wikipediaIcon.cloneNode(true))
Expand All @@ -134,7 +140,7 @@ window.addEventListener("load", function(event) {
element.prepend(bookIcon.cloneNode(true))
}
// youtube
// youtube
if (element.href.includes("youtube.com")) {
element.prepend(youtubeIcon.cloneNode(true))
}
Expand All @@ -144,12 +150,12 @@ window.addEventListener("load", function(event) {
element.prepend(twitterIcon.cloneNode(true))
}
// bluesky
// bluesky
if (element.href.includes("bsky.app")) {
element.prepend(blueskyIcon.cloneNode(true))
}
// mastodon
// mastodon
if (element.href.includes("__type=mastodon")) {
element.prepend(mastodonIcon.cloneNode(true))
}
Expand Down

0 comments on commit 3e0f1b9

Please sign in to comment.