I am trying to figure out a way to share content between sites, more specifically pages, which are generated during build using a content adapter from a JSON file.
They way I see it is there are a few potential routes:
Use modules- that are pulling site/data/contentfile.json & _content.gotmpl from source and bringing to a target site
Use some sort of RSS architecture to broadcast RSS feed from content adapter pages- and some template to fetch these pages- maybe convert to a JSON and create pages on build
Just add the data used in go template to some remote repo- and use get.resource on both sites to pull the same data
Would love some theoretical guidance here on how to approach this type of content sharing- my ideal workflow would be that I can bulk create pages from JSON on a source site (call it site 1) and be able to fetch and create these pages one site 2.
Any help understanding this kind of thing would be much appreciated - thanks in advance for any advice!
I would recommend not loading (big) content files from /data. For data that’s used once (or very big JSON files), using resources.Get/GetRemote | transform.Unmarshal is much more (memory) effective.
As to your other questions, I’m not sure I understand the problem.
If the content adapter is light weight simple and fast, i would probably just share the template logic (e.g. via a partial in a module) and then have the content adapters run twice from the same source.
Thanks for the response here, as for the confusion, I am just spitballing ideas but allow me to try and clarify my inquiry.
For this example lets say I have a JSON (I store it in a remote repo) that contains data for creating blog posts. A go template pulls this JSON file in with this
resources.Get/GetRemote | transform.Unmarshal
and builds pages, taxonomies, and sections based on entries in this JSON file. Simply put I just want to know how to share this content between Hugo sites.
I am really just trying to figure out the most streamlined way to have changes to this file (I add a blog post/page to the JSON file) be applied across other Hugo sites. Am I correct in understanding that the best way to do this is to import a module with the go template on the sites where I want the blog pages added?
My instinct would be to initialize a module containing hugoSite/content/blogPosts/_content.gotmpl
and import this on desired sites- given this template pulls from the data from remote.
Does this seem like the right approach to go about content sharing?