Skip to content

DenBeke/koekr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koekr

Static site generator for HTLM templates.

Why?

I needed a tool to quickly generate multiple static HTML pages with the same header/footer/navigation.
I didn't need a complete markdown-based static site generator like Hugo or Jykell, but just some simple HTML themes.

So if you're expecting a full-grown magic framework to write your blog, take a look at 'real things'.

I only created Koekr to help me create static websites for clients.

Usage

  1. Create an config.toml file and add some variables to it.
    Example of config:

     [site]
     title = "Koekr"
     url = "https://test.com"
     
     [copyright]
     
     name = "DenBeke"
     year = 2017
    
  2. Create HTML files in the pages directory. The complete content of those files can be accessed in index.html like this: {{ .page.content }} If you want to add variables to your pages, you can do so by writing TOML, enclosed by ---.
    Example of a page:

     ---
     title = "Hello world!"
     ---
     <p>Koekestad!</p>
    
  3. Create an index.html page and use the variables you defined.
    Example of the index template:

     <!DOCTYPE html>
     <html>
     <head>
         <title>{{ .site.title }}</title>
     </head>
     <body>
     
         <h1>{{ .page.title }}</h1>
     
         {{.page.content}}
     
         <footer>
             &copy; {{ .copyright.year }} - {{ .copyright.name }}
         </footer>
     
     </body>
     </html>
    
  4. Put your assets in the assets directory. That directory gets copied to generated/assets each time you run Koekr.

  5. Run Koekr from the command line:

     $ koekr
    

    Use the --watch command line argument if you want Koekr to listen for file changes. Koekr listens for:

    • Changes in the assets directory (not in subdirectories at the moment)
    • Changes in the pages directory (not in subdirectories at the moment)
    • Changes to the config file
    • Changes to the template file (only if it's a single file at the moment)
  6. Profit!

Author

Mathias Beke