summaryrefslogtreecommitdiffstats
path: root/hugolib/pages_process.go
diff options
context:
space:
mode:
authorSatowTakeshi <doublequotation@gmail.com>2021-04-18 16:13:00 +0900
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-03-08 19:27:54 +0100
commit7d8011ed63d587b87a7c182748914fe146590093 (patch)
treecde6c99c5a439e64e0a2e5c9d2f0d4b03eba6577 /hugolib/pages_process.go
parentb9a1be2f9961516a674ff15a409433606e70ac7b (diff)
Allow rendering static files to disk and dynamic to memory in server mode
Updates #9625
Diffstat (limited to 'hugolib/pages_process.go')
-rw-r--r--hugolib/pages_process.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/hugolib/pages_process.go b/hugolib/pages_process.go
index 541c0ae3e..59b20dabc 100644
--- a/hugolib/pages_process.go
+++ b/hugolib/pages_process.go
@@ -33,9 +33,10 @@ func newPagesProcessor(h *HugoSites, sp *source.SourceSpec) *pagesProcessor {
procs := make(map[string]pagesCollectorProcessorProvider)
for _, s := range h.Sites {
procs[s.Lang()] = &sitePagesProcessor{
- m: s.pageMap,
- errorSender: s.h,
- itemChan: make(chan interface{}, config.GetNumWorkerMultiplier()*2),
+ m: s.pageMap,
+ errorSender: s.h,
+ itemChan: make(chan interface{}, config.GetNumWorkerMultiplier()*2),
+ renderStaticToDisk: h.Cfg.GetBool("renderStaticToDisk"),
}
}
return &pagesProcessor{
@@ -118,6 +119,8 @@ type sitePagesProcessor struct {
ctx context.Context
itemChan chan interface{}
itemGroup *errgroup.Group
+
+ renderStaticToDisk bool
}
func (p *sitePagesProcessor) Process(item interface{}) error {
@@ -162,7 +165,12 @@ func (p *sitePagesProcessor) copyFile(fim hugofs.FileMetaInfo) error {
defer f.Close()
- return s.publish(&s.PathSpec.ProcessingStats.Files, target, f)
+ fs := s.PublishFs
+ if p.renderStaticToDisk {
+ fs = s.PublishFsStatic
+ }
+
+ return s.publish(&s.PathSpec.ProcessingStats.Files, target, f, fs)
}
func (p *sitePagesProcessor) doProcess(item interface{}) error {