HUGO

Building headless cms based on standard library of hugo

Hello, I’m on the way to build an api library based on standard library of hugo. Extensibility as a headless Hugo CMS (is going to be open source for the community)

I have a type of page lets say mypage (impelment the Page interface):

type mypage struct {
	description string
	title       string
	linkTitle   string

	section string

	content string

	fuzzyWordCount int

	path string

	slug string

	// Dates
	date       time.Time
	lastMod    time.Time
	expiryDate time.Time
	pubDate    time.Time

	weight int

	params map[string]interface{}
	data   map[string]interface{}

	file source.File
}

My question: What is the best way to use the standard hugo library to get specific section pages and convert all of them to the type “mypage” without build the whole sites.

I am looking at the hugo file system https://pkg.go.dev/github.com/gohugoio/hugo@v0.68.3/hugolib/filesystems?tab=doc I have spend some hours but I dont find any way to get the content of any kind without build the whole site. For example the SourceFilesystem can be use to get a content type from the “content”.

Can anyone help me I would greatly appreciate it

OK I use the hugo file system and page parser to get the content of the pages and manually create them to my type mypage

If some one know a better way to achieve this I would like to know it.
Thank you

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.