Skip to content
This repository was archived by the owner on Apr 15, 2019. It is now read-only.
This repository was archived by the owner on Apr 15, 2019. It is now read-only.

Multiple template problem #5

@aolmez

Description

@aolmez

Hi

i have a login page and dont want use master page but other pages can be use master page.

i set .HTMLRender = gintemplate.New(gintemplate.TemplateConfig{
Root: "views",
Extension: ".html",
Master: "layouts/master",
Partials: []string{},
Funcs: template.FuncMap{
"copy": func() string {
return time.Now().Format("2018")
},
},
DisableCache: isDebugMode,
})

but my application start with login page set empty temlate config but give an error. it wants to use master page can you help me ?

emptyMasterPage := gintemplate.NewMiddleware(gintemplate.TemplateConfig{
	Root:         "views",
	Extension:    ".html",
	Master:       "",
	Partials:     []string{},
	DisableCache: true,
})

server.Engine().GET("/", func(ctx *gin.Context) {
	// With the middleware, `HTML()` can detect the valid TemplateEngine.
	gintemplate.HTML(ctx, http.StatusOK, "account/login", gin.H{
		"title": "Backend title!",
	})
},  server.EmptyMasterPage())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions