Buy Me a Coffee

일반적으로 사용하는 “Buy Me a Coffee” 서비스를 통해 시작할 수 있습니다. 이 서비스는 크리에이터들이 팬이나 후원자들로부터 작은 금액을 기부받을 수 있는 플랫폼을 제공합니다. 아래는 “Buy Me a Coffee"에 가입하고 웹사이트에 버튼을 추가하는 단계별 과정입니다:

Buy Me a Coffee 가입하기

  • 웹사이트 방문
  • 가입하기
    • 홈페이지에서 “Sign up"을 클릭하고, 이메일 주소 또는 소셜 미디어 계정을 통해 가입합니다.
  • 프로필 설정
    • 프로필 정보를 입력하고, 받고 싶은 기부에 대한 세부 사항을 설정합니다.
    • 예를 들어, 한 커피의 가격을 설정할 수 있습니다.
  • 결제 정보 등록
    • 기부금을 받기 위한 결제 정보를 등록합니다. PayPal이나 Stripe 계정을 연결할 수 있습니다.

버튼 추가

버튼생성

  • 대시보드 접속
    • Buy Me a Coffee 대시보드에서 ‘Settings’ 섹션을 찾아 ‘Buttons & Graphics’를 클릭합니다.
  • 버튼 스타일 선택
    • 다양한 버튼 스타일 중에서 선택하고, 필요한 설정을 조정합니다.
  • 코드 복사
    • 생성된 HTML 코드를 복사합니다. 이 코드는 웹사이트에 버튼을 삽입하는 데 사용됩니다.

사이트에 버튼 추가

  • HTML 파일 수정
    • layouts/partials/sidebar.html 편집기로 엽니다.
  • 버튼 코드 삽입
    • 적절한 위치에 복사한 HTML 코드를 붙여넣습니다.
    • 주로 사이드바의 하단에 배치하는 것이 일반적입니다.
    • 여기에서는 사이드바 최하단에 배치합니다..
<aside class="sidebar-container hx-flex hx-flex-col print:hx-hidden md:hx-top-16 md:hx-shrink-0 md:hx-w-64 md:hx-self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
  <!-- Search bar on small screen -->
  <div class="hx-px-4 hx-pt-4 md:hx-hidden">
    {{ partial "search.html" }}
  </div>
  <div class="hextra-scrollbar hx-overflow-y-auto hx-overflow-x-hidden hx-p-4 hx-grow md:hx-h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
    <ul class="hx-flex hx-flex-col hx-gap-1 md:hx-hidden">
      <!-- Nav -->
      {{ template "sidebar-main" (dict "context" site.Home "pageURL" $pageURL "page" $context "toc" true) -}}
      {{ template "sidebar-footer" }}
    </ul>
    <!-- Sidebar on large screen -->
    {{- if $disableSidebar -}}
      {{- if $displayPlaceholder }}<div class="max-xl:hx-hidden hx-h-0 hx-w-64 hx-shrink-0"></div>{{ end -}}
      {{ .context.Scratch.Set "enableFooterSwitches" true }}
    {{- else -}}
      <ul class="hx-flex hx-flex-col hx-gap-1 max-md:hx-hidden">
        {{ template "sidebar-main" (dict "context" $navRoot "page" $context  "pageURL" $pageURL) }}
        {{ template "sidebar-footer" }}
      </ul>
    {{ end -}}
  </div>  
{{/* "Buy me a coffee" link 추가 */}}
</div>
<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="aprofl" data-color="#FFDD00" data-emoji="☕"  data-font="Poppins" data-text="Buy me a coffee" data-outline-color="#000000" data-font-color="#000000" data-coffee-color="#ffffff" ></script>
  </a>

buymeacoffee_button.png

커스터마이징

  • 사이트의 스타일에 맞게 수정하거나 디자인할 수 있습니다.
{{/* "Buy me a coffee" link 추가 */}}
<div class="hx-px-4 hx-pt-">
  <a href="https://www.buymeacoffee.com/aprofl" target="_blank"
     style="
       color: #ffda62; /* 오렌지색 텍스트 */       
       padding: 12px 24px; /* 버튼 크기 */
       display: inline-flex; /* 플렉스를 사용해 가운데 정렬 */
       justify-content: center; /* 가운데 정렬 */
       align-items: center; /* 가운데 정렬 */
       width: 100%; /* 전체 폭 사용 */
       background-color: inherit; /* 부모 요소의 배경색 따름 */
       text-align: center; /* 텍스트 가운데 정렬 */
     "
     aria-label="Buy me a Coffee">
     <img src="https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg" alt="Buy me a coffee" style="height: 20px; margin-right: 8px;">
    Buy me a coffee
  </a>
</div>

buymeacoffee_custom.png

sidebar.html

최종 내용은 다음과 같습니다.

{{- $context := .context -}}
{{- $disableSidebar := .disableSidebar | default false -}}
{{- $displayPlaceholder := .displayPlaceholder | default false -}}
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hx-hidden xl:hx-block" "md:hx-hidden") "md:hx-sticky" -}}
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
{{- $pageURL := $context.RelPermalink -}}
{{/* EXPERIMENTAL */}}
{{- if .context.Params.sidebar.hide -}}
  {{- $disableSidebar = true -}}
  {{- $displayPlaceholder = true -}}
{{- end -}}
<div class="mobile-menu-overlay [transition:background-color_1.5s_ease] hx-fixed hx-inset-0 hx-z-10 hx-bg-black/80 dark:hx-bg-black/60 hx-hidden"></div>
<aside class="sidebar-container hx-flex hx-flex-col print:hx-hidden md:hx-top-16 md:hx-shrink-0 md:hx-w-64 md:hx-self-start max-md:[transform:translate3d(0,-100%,0)] {{ $sidebarClass }}">
  <!-- Search bar on small screen -->
  <div class="hx-px-4 hx-pt-4 md:hx-hidden">
    {{ partial "search.html" }}
  </div>
  <div class="hextra-scrollbar hx-overflow-y-auto hx-overflow-x-hidden hx-p-4 hx-grow md:hx-h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
    <ul class="hx-flex hx-flex-col hx-gap-1 md:hx-hidden">
      <!-- Nav -->
      {{ template "sidebar-main" (dict "context" site.Home "pageURL" $pageURL "page" $context "toc" true) -}}
      {{ template "sidebar-footer" }}
    </ul>
    <!-- Sidebar on large screen -->
    {{- if $disableSidebar -}}
      {{- if $displayPlaceholder }}<div class="max-xl:hx-hidden hx-h-0 hx-w-64 hx-shrink-0"></div>{{ end -}}
      {{ .context.Scratch.Set "enableFooterSwitches" true }}
    {{- else -}}
      <ul class="hx-flex hx-flex-col hx-gap-1 max-md:hx-hidden">
        {{ template "sidebar-main" (dict "context" $navRoot "page" $context  "pageURL" $pageURL) }}
        {{ template "sidebar-footer" }}
      </ul>
    {{ end -}}
  </div>  
  
{{/* "Buy me a coffee" link 추가 */}}
<div class="hx-px-4 hx-pt-">
  <a href="https://www.buymeacoffee.com/aprofl" target="_blank"
     style="
       color: #ffda62; /* 오렌지색 텍스트 */       
       padding: 12px 24px; /* 버튼 크기 */
       display: inline-flex; /* 플렉스를 사용해 가운데 정렬 */
       justify-content: center; /* 가운데 정렬 */
       align-items: center; /* 가운데 정렬 */
       width: 100%; /* 전체 폭 사용 */
       background-color: inherit; /* 부모 요소의 배경색 따름 */
       text-align: center; /* 텍스트 가운데 정렬 */
     "
     aria-label="Buy me a Coffee">
     <img src="https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg" alt="Buy me a coffee" style="height: 20px; margin-right: 8px;">
    Buy me a coffee
  </a>
</div>
</aside>
{{- define "sidebar-main" -}}
  {{ template "sidebar-tree" (dict "context" .context "level" 0 "page" .page "pageURL" .pageURL "toc" (.toc | default false)) }}
{{- end -}}
{{- define "sidebar-tree" -}}
  {{- if ge .level 4 -}}
    {{- return -}}
  {{- end -}}
  {{- $context := .context -}}
  {{- $page := .page }}
  {{- $pageURL := .page.RelPermalink -}}
  {{- $level := .level -}}
  {{- $toc := .toc | default false -}}
  {{- with $items := union .context.RegularPages .context.Sections -}}
    {{- $items = where $items "Params.sidebar.exclude" "!=" true -}}
    {{- if eq $level 0 -}}
      {{- range $items.ByWeight }}
        {{- if .Params.sidebar.separator -}}
          <li class="[word-break:break-word] hx-mt-5 hx-mb-2 hx-px-2 hx-py-1.5 hx-text-sm hx-font-semibold hx-text-gray-900 first:hx-mt-0 dark:hx-text-gray-100">
            <span class="hx-cursor-default">{{ partial "utils/title" . }}</span>
          </li>
        {{- else -}}
          {{- $active := eq $pageURL .RelPermalink -}}
          {{- $shouldOpen := or (.Params.sidebar.open) (.IsAncestor $page) $active | default true }}
          <li class="{{ if $shouldOpen }}open{{ end }}">
            {{- $linkTitle := partial "utils/title" . -}}
            {{- template "sidebar-item-link" dict "context" . "active" $active "title" $linkTitle "link" .RelPermalink -}}
            {{- if and $toc $active -}}
              {{- template "sidebar-toc" dict "page" . -}}
            {{- end -}}
            {{- template "sidebar-tree" dict "context" . "page" $page "pageURL" $pageURL "level" (add $level 1) "toc" $toc -}}
          </li>
        {{- end -}}
      {{- end -}}
    {{- else -}}
      <div class="ltr:hx-pr-0 hx-overflow-hidden">
        <ul class='hx-relative hx-flex hx-flex-col hx-gap-1 before:hx-absolute before:hx-inset-y-1 before:hx-w-px before:hx-bg-gray-200 before:hx-content-[""] ltr:hx-ml-3 ltr:hx-pl-3 ltr:before:hx-left-0 rtl:hx-mr-3 rtl:hx-pr-3 rtl:before:hx-right-0 dark:before:hx-bg-neutral-800'>
          {{- range $items.ByWeight }}
            {{- $active := eq $pageURL .RelPermalink -}}
            {{- $shouldOpen := or (.Params.sidebar.open) (.IsAncestor $page) $active | default true }}
            {{- $linkTitle := partial "utils/title" . -}}
            <li class="hx-flex hx-flex-col {{ if $shouldOpen }}open{{ end }}">
              {{- template "sidebar-item-link" dict "context" . "active" $active "title" $linkTitle "link" .RelPermalink -}}
              {{- if and $toc $active -}}
                {{ template "sidebar-toc" dict "page" . }}
              {{- end }}
              {{ template "sidebar-tree" dict "context" . "page" $page "pageURL" $pageURL "level" (add $level 1) "toc" $toc }}
            </li>
          {{- end -}}
        </ul>
      </div>
    {{- end -}}
  {{- end }}
{{- end -}}
{{- define "sidebar-toc" -}}
  {{ $page := .page }}
  {{ with $page.Fragments.Headings }}
    <ul class='hx-flex hx-flex-col hx-gap-1 hx-relative before:hx-absolute before:hx-inset-y-1 before:hx-w-px before:hx-bg-gray-200 before:hx-content-[""] dark:before:hx-bg-neutral-800 ltr:hx-pl-3 ltr:before:hx-left-0 rtl:hx-pr-3 rtl:before:hx-right-0 ltr:hx-ml-3 rtl:hx-mr-3'>
      {{- range . }}
        {{- with .Headings }}
          {{- range . -}}
            <li>
              <a
                href="#{{ anchorize .ID }}"
                class="hx-flex hx-rounded hx-px-2 hx-py-1.5 hx-text-sm hx-transition-colors [word-break:break-word] hx-cursor-pointer [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] contrast-more:hx-border hx-gap-2 before:hx-opacity-25 before:hx-content-['#'] hx-text-gray-500 hover:hx-bg-gray-100 hover:hx-text-gray-900 dark:hx-text-neutral-400 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50 contrast-more:hx-text-gray-900 contrast-more:dark:hx-text-gray-50 contrast-more:hx-border-transparent contrast-more:hover:hx-border-gray-900 contrast-more:dark:hover:hx-border-gray-50"
              >
                {{- .Title -}}
              </a>
            </li>
          {{ end -}}
        {{ end -}}
      {{ end -}}
    </ul>
  {{ end }}
{{- end -}}
{{- define "sidebar-footer" -}}
  {{- range site.Menus.sidebar -}}
    {{- $name := or (T .Identifier) .Name -}}
    {{ if eq .Params.type "separator" }}
      <li class="[word-break:break-word] hx-mt-5 hx-mb-2 hx-px-2 hx-py-1.5 hx-text-sm hx-font-semibold hx-text-gray-900 first:hx-mt-0 dark:hx-text-gray-100">
        <span class="hx-cursor-default">{{ $name }}</span>
      </li>
    {{ else }}
      <li>{{ template "sidebar-item-link" dict "active" false "title" $name "link" (.URL | relLangURL) }}</li>
    {{ end }}
  {{- end -}}
{{- end -}}
{{- define "sidebar-item-link" -}}
  {{- $external := strings.HasPrefix .link "http" -}}
  {{- $open := .open | default true -}}
  <a
    class="hx-flex hx-items-center hx-justify-between hx-gap-2 hx-cursor-pointer hx-rounded hx-px-2 hx-py-1.5 hx-text-sm hx-transition-colors [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] [word-break:break-word]
    {{- if .active }}
      sidebar-active-item hx-bg-primary-100 hx-font-semibold hx-text-primary-800 contrast-more:hx-border contrast-more:hx-border-primary-500 dark:hx-bg-primary-400/10 dark:hx-text-primary-600 contrast-more:dark:hx-border-primary-500
    {{- else }}
      hx-text-gray-500 hover:hx-bg-gray-100 hover:hx-text-gray-900 contrast-more:hx-border contrast-more:hx-border-transparent contrast-more:hx-text-gray-900 contrast-more:hover:hx-border-gray-900 dark:hx-text-neutral-400 dark:hover:hx-bg-primary-100/5 dark:hover:hx-text-gray-50 contrast-more:dark:hx-text-gray-50 contrast-more:dark:hover:hx-border-gray-50
    {{- end -}}"
    href="{{ .link }}"
    {{ if $external }}target="_blank" rel="noreferer"{{ end }}
  >
    {{- .title -}}
    {{- with .context }}
      {{- if or .RegularPages .Sections }}
        <span class="hextra-sidebar-collapsible-button">
          {{- template "sidebar-collapsible-button" -}}
        </span>
      {{- end }}
    {{ end -}}
  </a>
{{- end -}}
{{- define "sidebar-collapsible-button" -}}
  <svg fill="none" viewBox="0 0 24 24" stroke="currentColor" class="hx-h-[18px] hx-min-w-[18px] hx-rounded-sm hx-p-0.5 hover:hx-bg-gray-800/5 dark:hover:hx-bg-gray-100/5"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" class="hx-origin-center hx-transition-transform rtl:-hx-rotate-180"></path></svg>
{{- end -}}