#6: Cara Membuat Tema Hugo dari Awal – Kode Pendek

mrfdn.com – Kode pendek di Hugo adalah cara untuk memanggil elemen tertentu di situs

Misalnya kita ingin membuat toc (terms of service) di artikel Hugo, kita bisa dengan mudah memanggilnya dengan shortcode.

Kode pendek juga tersedia di WordPress.

Namun membuat shortcode di WP cukup sulit, berbeda dengan HUGO dimana kita hanya perlu membuat file shortcode lalu memanggilnya kemanapun kita mau.

Membuat shortcode TOC di Hugo#

kode pendek strukturhugo

Pertama buat folder bernama shortcodes di dalam folder tata letak Tema kami.

Kemudian buat file html dengan nama di folder shortcodes toc.html.

File kode pendek dibuat dalam format HTML.

Selanjutnya, isi file toc.html dengan kode berikut:

<div>
  <h2>Daftar Isi</h2>
  {{ .Page.TableOfContents }}
</div>

TOC sudah dibuat, sekarang untuk membuatnya berfungsi kita hanya perlu memanggilnya melalui artikel yang kita ingin TOC tampilkan di dalamnya.

Silakan edit salah satu file artikel Anda, pastikan memiliki header

Setelah itu silahkan masukkan baris berikut tanpa spasi.

{{ <toc> }}

Jadi TOC di lokasi tersebut akan otomatis dirender oleh Hugo.

Tentang kode pendek di Hugo#

Kemudian saya mencoba membuat artikel tentang cara membuat shortcode untuk menampilkan elemen iframe di Hugo.

Anda dapat membuat kode pendek untuk menampilkan apa saja.

Bisa berupa elemen div, paragraf, kutipan, tombol share, atau apapun yang ingin Anda tampilkan.

Anda perlu mengetahui cara menulis shortcode dengan benar.

Nama file shortcode secara otomatis akan menjadi shortcode yang dipanggil.

Misalnya, Anda membuat kode pendek dengan nama toc.html Kemudian akan dikatakan dengan toc Juga.

Semoga artikel ini bermanfaat.

PakarPBN

A Private Blog Network (PBN) is a collection of websites that are controlled by a single individual or organization and used primarily to build backlinks to a “money site” in order to influence its ranking in search engines such as Google. The core idea behind a PBN is based on the importance of backlinks in Google’s ranking algorithm. Since Google views backlinks as signals of authority and trust, some website owners attempt to artificially create these signals through a controlled network of sites.

In a typical PBN setup, the owner acquires expired or aged domains that already have existing authority, backlinks, and history. These domains are rebuilt with new content and hosted separately, often using different IP addresses, hosting providers, themes, and ownership details to make them appear unrelated. Within the content published on these sites, links are strategically placed that point to the main website the owner wants to rank higher. By doing this, the owner attempts to pass link equity (also known as “link juice”) from the PBN sites to the target website.

The purpose of a PBN is to give the impression that the target website is naturally earning links from multiple independent sources. If done effectively, this can temporarily improve keyword rankings, increase organic visibility, and drive more traffic from search results.

Jasa Backlink

Download Anime Batch

Tinggalkan Komentar

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *