DEV Community

Cover image for Golang Web - Render Partial HTML Template
Ega Prasetya
Ega Prasetya

Posted on

3 2

Golang Web - Render Partial HTML Template

In this series, we will to learn how to Create, Parsing, and Render all it files, so lets do it.

Structure Application

Create new project, prepare files, and folder with arrangement like with this picture.

Alt Text

Backend

Open file main.go, and then fill in the following code

Alt Text

Next, still in the function main, add the new both Route

Alt Text

Frontend

  • Open file index.html, and then write this code.

Alt Text

  • File about.html

Alt Text

  • File _header.html

Alt Text

  • File _message.html

Alt Text

Run & Test

Alt Text

Alt Text

Finally! Grats, hope your enjoy it.

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️