aboutsummaryrefslogtreecommitdiffstats
path: root/site.go
diff options
context:
space:
mode:
authorEddy Pedroni <epedroni@pm.me>2025-04-08 17:01:55 +0200
committerEddy Pedroni <epedroni@pm.me>2025-04-08 17:02:46 +0200
commit83d175b7b069bc3bbc0d600c2fab4d082e04b521 (patch)
tree9d1b7975ad16f7d5433285d3fab0a7cc38d24564 /site.go
parent38b40d8c5a8915716b3aa46aac4a0a84d0113b25 (diff)
Python implementation with better multi-entry page support
Diffstat (limited to 'site.go')
-rw-r--r--site.go56
1 files changed, 0 insertions, 56 deletions
diff --git a/site.go b/site.go
deleted file mode 100644
index 0098fd8..0000000
--- a/site.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package main
-
-import (
- "io/ioutil"
- "os"
- "path/filepath"
-)
-
-type siteData struct {
- name string
- rawName string
- baseUrl string
- sourcePath string
- pages map[string]page
- nav []navItem
-}
-
-func getSites(cfg config) (sites []siteData) {
- files, err := ioutil.ReadDir(cfg.DocsRoot)
- if err != nil {
- panic(err)
- }
-
- for _, f := range files {
- if f.IsDir() && f.Name() != ".git" {
- newSite := siteData{
- name: nameify(f.Name()),
- rawName: f.Name(),
- baseUrl: cfg.BaseUrl + "/" + f.Name(),
- sourcePath: filepath.Join(cfg.DocsRoot, f.Name())}
- sites = append(sites, newSite)
- }
- }
-
- return
-}
-
-func generateSite(site siteData, cfg config, outputDir string) {
- template := loadTemplate(cfg)
- templData := templateData{SiteTitle: site.name,
- StylesheetUrl: cfg.BaseUrl + "/style.css",
- Nav: site.nav}
- for k, v := range site.pages {
- templData.Content = v.content
- err := applyTemplate(filepath.Join(outputDir, site.rawName, k), templData, template)
- if err != nil {
- panic(err)
- }
- }
-
- // link assets to generation directory
- err := os.Symlink(filepath.Join(site.sourcePath, "assets"), filepath.Join(outputDir, site.rawName, "assets"))
- if err != nil {
- panic(err)
- }
-}