diff --git a/sui/core/compile.go b/sui/core/compile.go
index 0c0e053f..3624c373 100644
--- a/sui/core/compile.go
+++ b/sui/core/compile.go
@@ -93,8 +93,10 @@ func (page *Page) Compile(ctx *BuildContext, option *BuildOption) (string, []str
}
// Page Components
- rawComponents, _ := jsoniter.MarshalToString(ctx.components)
- body.AppendHtml("\n\n" + `\n\n")
+ if ctx != nil && ctx.components != nil && len(ctx.components) > 0 {
+ rawComponents, _ := jsoniter.MarshalToString(ctx.components)
+ body.AppendHtml("\n\n" + `\n\n")
+ }
page.ReplaceDocument(doc)
html, err := doc.Html()