diff --git a/lib/web/docusaurus/dsite_add.v b/lib/web/docusaurus/dsite_add.v index 208794ac..4c2301a5 100644 --- a/lib/web/docusaurus/dsite_add.v +++ b/lib/web/docusaurus/dsite_add.v @@ -68,24 +68,11 @@ pub fn dsite_add(args_ AddArgs) !&DocSite { if args.path_publish == '' { args.path_publish = '${f.path_publish.path}/${args.sitename}' } - path_build_ := '${f.path_build.path}/${args.sitename}' - // get our website - console.print_debug('Docusaurus site ${args.sitename} at ${args.path}.') - mut mysite := site.new(name: args.sitename)! - mut plbook := playbook.new(path: '${args.path}/cfg')! - if plbook.actions.len == 0 { - return error('No actions found in playbook at ${args.path}/cfg') - } - site.play(mut plbook)! - mysite = site.get(name: args.sitename) or { - return error('Failed to get site after playing playbook: ${args.sitename}') - } - - println(mysite) - if true{panic("ss8")} - + // Get the site object after processing, this is the website which is a generic definition of a site + mut website := sitegen.get(name: site.name)! + // Create the DocSite instance mut dsite := &DocSite{ name: args.sitename @@ -99,3 +86,4 @@ pub fn dsite_add(args_ AddArgs) !&DocSite { docusaurus_sites[args.sitename] = dsite return dsite } + diff --git a/lib/web/docusaurus/dsite_generate.v b/lib/web/docusaurus/dsite_generate.v index a0980b01..f8f3ba17 100644 --- a/lib/web/docusaurus/dsite_generate.v +++ b/lib/web/docusaurus/dsite_generate.v @@ -46,25 +46,7 @@ pub fn (mut site DocSite) generate() ! { mut aa := site.path_src.dir_get('docs')! aa.copy(dest: '${f.path_build.path}/docs', delete: true)! } - - // now we need to process the pages, call the sitegen module, which will look for statements like - // !!site.page sitename:'atest' - // path:"crazy/sub.md" position:1 - // src:"marketplace_specs:tft_tfp_marketplace" - // title:"Just a Page" - // description:"A description not filled in" - // draft:1 hide_title:1 - - configpath := '${site.path_src.path}/cfg' - - // Create a playbook from the config path and run site processing - mut plbook := playbook.new(path: configpath)! - sitegen.play(mut plbook)! - - // Get the updated site object after processing - mut website := sitegen.get(name: site.name)! - - + mut main_file := pathlib.get_file(path: '${cfg_path}/main.json', create: true)! main_file.write(json.encode_pretty(site.config.main))!