Danh mụcThẻBài viết

admin

I'm a Full-stack developer

Thẻ

Linked List
Data Structure
Chat GPT
Design Pattern
Microservices
API
AWS CDK
ReactJS
AWS Lightsail
Flutter Mobile
Part 5: Creating a Tag List Page on Ghost CMS
Ngày đăng: 17/06/2023

In this article, I will show you how to create a Tag list page using the Casper theme.


Create a file in the theme folder



  • Create a custom-tags.hbs file with the following content
{{!< default}}
{{!-- The tags above means: insert everything in this file
into the {body} tag of the default.hbs template --}}

{{#post}}
{{!-- Everything inside the #post block pulls data from the post --}}

<main id="site-main" class="site-main outer">
    <div class="inner article posts tags">
        <h1 class="article-title">{{title}}</h1>

        <div class="tags-title-description">
            {{content}}
        </div>
        
       <div class="post-feed">
            {{#get 'tags' limit='all' include='count.posts' order='count.posts desc'}}
                {{#foreach tags}}
                        
                    {{> "tag-card"}}
                    
                {{/foreach}}
            {{/get}}
        </div>
    </div>
</main>

{{/post}}




  • Create file partials/tag-card.hbs
{{!-- This is a partial file used to generate a tag "card"
which templates loop over to generate a list of tags. --}}

<article class="post-card tag-card">

    {{#if feature_image}}
    <a class="post-card-image-link" href="{{url}}">
        {{!-- This is a responsive image, it loads different sizes depending on device
        https://medium.freecodecamp.org/a-guide-to-responsive-images-with-ready-to-use-templates-c400bd65c433 --}}
        <img class="post-card-image"
            {{!-- srcset="{{img_url feature_image size="s"}} 300w,
                    {{img_url feature_image size="m"}} 600w,
                    {{img_url feature_image size="l"}} 1000w,
                    {{img_url feature_image size="xl"}} 2000w" --}}
            sizes="(max-width: 1000px) 400px, 800px"
            src="{{img_url feature_image size="m"}}"
            alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}"
            loading="lazy"
        />
    </a>
    {{/if}}

    <a class="tag tag-card-content" href="{{url}}">
        <div class="post-card-content">
            <header class="post-card-header">
                <div class="tag-card-content-post-count">{{ count.posts }} POST</div>
                <h2 class="post-card-title tag-card-content-title">{{name}}</h2>
            </header>
        </div>{{!--/.post-card-content--}}
    </a>

</article>


Create static page tags



  • URL should be tags
  • Select the new theme created in the above step
  • Publish page


Achievement


I wish you make the tag list page as desired!!!

Đề xuất

TypeScript Design Pattern - Abstract Factory
admin07/08/2023

TypeScript Design Pattern - Abstract Factory
The abstract factory pattern is one of five design patterns in the Creational Design Pattern group. The abstract factory provides an interface for creating families of related or dependent objects without specifying their concrete classes.
JOI - API schema validation
admin12/06/2023

JOI - API schema validation
Data validation is one of topics that I am interesting. I always review my code after developed features or fixed bugs. There are many places where need to validate data, it is really terrible. Some cases, we need to validate data input because ensure the data into API, it will not make any problems to crash system.
How to integrate ChatGPT-3.5 Turbo into Node.js
admin10/01/2024

How to integrate ChatGPT-3.5 Turbo into Node.js
Step-by-Step Guide to Incorporating ChatGPT-3.5 Turbo into Node.js for Basic ReactJS Applications
Mới nhất

NodeJS Verify and Decode Cognito JWT Tokens
admin12/06/2023

NodeJS Verify and Decode Cognito JWT Tokens
In this article, I will show you how to verify and decode the Cognito JWT Tokens token.
Writing a Data Transformation Pipeline Using Go
admin20/03/2024

Writing a Data Transformation Pipeline Using Go
In this article, I will show how to implement data processing using the Go programing language with a simple tutorial.
Next.js 14 App Router Localization with next-intl
admin07/07/2024

Next.js 14 App Router Localization with next-intl
In this article, I will illustrate how to implement next-intl localization in a Next.js 14 application
Đinh Thành Công Blog

My website, where I write blogs on a variety of topics and where I have some experiments with new technologies.

hotlinelinkedinskypezalofacebook
DMCA.com Protection Status
Góp ý
Họ & Tên
Số điện thoại
Email
Nội dung
Tải ứng dụng
hotline

copyright © 2023 - AGAPIFA

Privacy
Term
About