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

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())

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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