👪Inheritance (Extending)

If multiple of your files have a repetitive structure, you can define a template that your other files can extend. Templates can even extend other templates.

In your template you can define several blocks which you can then fill in the extending file.

base.corgi
block vars
  - lang := "en"

html(lang=lang)
head
  link(rel="stylesheet", href="/foo.css")
  title: block title
  block head
body: block body
extend "github.com/me/myproject/corgi/base.corgi"



block title Learn Corgi

block body
  p
    > Head over to
      #a(href="https://mavolin.gitbook.io/corgi")[GitBook]
      to learn corgi!


extend "base"

append vars
  - lang = "de"
  
block title Lerne Corgi
append head: link(rel="stylesheet", href="/fooz.css")

block body
  p 
    > Schau bei
      #a(href="https://mavolin.gitbook.io/corgi")[GitBook]
      vorbei, um corgi zu lernen!


Last updated