inblog logo
|
LHS's Study Space
    스프링부트

    [스프링 부트] 16. 부분 템플릿 분리

    lhs's avatar
    lhs
    Nov 18, 2024
    [스프링 부트] 16. 부분 템플릿 분리
    Contents
    1. header.mustache2. 적용할 템플릿
     

    1. header.mustache

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>blog</title> </head> <body> <nav> <ul> <li> <a href="/">홈</a> </li> <li> <a href="/save-form">글쓰기</a> </li> </ul> </nav> <hr>
    • 모든 페이지의 상단에 들어갈 header.mustache 파일을 layout 폴더에 생성한다.

    2. 적용할 템플릿

    {{> layout/header}} <section> <div> 번호: {{model.id}}<br> 제목: {{model.title}}<br> 내용: {{model.content}}<br> 작성일: {{model.createdAt}}<br> </div> </section> </body> </html>
    detail.mustache
    • 중괄호 두 개 사이에 >를 붙이고 그 뒤에 경로와 Mustache 파일명을 작성하여 부분 템플릿을 삽입한다.
    Share article
    Contents
    1. header.mustache2. 적용할 템플릿

    LHS's Study Space

    RSS·Powered by Inblog