diff --git a/.gitignore b/.gitignore index 2cdd29e6d..dffbfbb05 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Managed by documentation/Makefile +documentation/content/en/examples/ +documentation/content/en/function-catalog +documentation/layouts/shortcodes/listexamples.html +documentation/layouts/shortcodes/listfunctions.html +documentation/layouts/shortcodes/listversions.html +documentation/layouts/shortcodes/relatedexamples.html +documentation/layouts/partials/breadcrumb.html + go.work go.work.sum .DS_Store diff --git a/documentation/Makefile b/documentation/Makefile index 3d97a1046..fa7fbdc53 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -1,3 +1,28 @@ +EXTERNAL_REPO = https://github.com/kptdev/krm-functions-catalog.git +CLONE_DIR = tmp-krm-clone +CONTENT_SUBDIR = documentation/content/en/function-catalog/ +TARGET_HUGO_DIR = content/en/function-catalog/ + +LAYOUT_SUBDIR = documentation/layouts/ +TARGET_HUGO_LAYOUT_DIR = layouts/ + +EXAMPLES_SUBDIR = examples/ +TARGET_HUGO_EXAMPLES_DIR = content/en/examples/ + +.PHONY: serve production-build preview-build fetch-external-docs + +fetch-external-docs: + @echo "--- Starting content synchronization from $(EXTERNAL_REPO) ---" + rm -rf $(CLONE_DIR) + git clone --depth 1 $(EXTERNAL_REPO) $(CLONE_DIR) + mkdir -p $(TARGET_HUGO_DIR) + mkdir -p $(TARGET_HUGO_EXAMPLES_DIR) + cp -r $(CLONE_DIR)/$(CONTENT_SUBDIR)* $(TARGET_HUGO_DIR) + cp -r -n $(CLONE_DIR)/$(LAYOUT_SUBDIR)* $(TARGET_HUGO_LAYOUT_DIR) + cp -r $(CLONE_DIR)/$(EXAMPLES_SUBDIR)* $(TARGET_HUGO_EXAMPLES_DIR) + rm -rf $(CLONE_DIR) + @echo "--- External documentation ready in $(TARGET_HUGO_DIR) ---" + serve: hugo server \ --disableFastRender \ @@ -12,14 +37,16 @@ serve: --templateMetricsHints \ --gc -production-build: + +production-build: fetch-external-docs git submodule update --init --recursive hugo version hugo \ --minify npx -y pagefind --site public -preview-build: + +preview-build: fetch-external-docs git submodule update --init --recursive hugo \ --baseURL $(DEPLOY_PRIME_URL) \ @@ -27,4 +54,3 @@ preview-build: --buildFuture \ --minify npx -y pagefind --site public - diff --git a/documentation/config.toml b/documentation/config.toml index 0cda7408f..f31b623a0 100644 --- a/documentation/config.toml +++ b/documentation/config.toml @@ -106,13 +106,13 @@ copyright = "kpt contributors " # This menu appears only if you have at least one [params.versions] set. #version_menu = "Releases" -# Flag used in the "version-banner" partial to decide whether to display a +# Flag used in the "version-banner" partial to decide whether to display a # banner on every page indicating that this is an archived version of the docs. # Set this flag to "true" if you want to display the banner. #archived_version = false # The version number for the version of the docs represented in this doc set. -# Used in the "version-banner" partial to display a version number for the +# Used in the "version-banner" partial to display a version number for the # current doc set. #version = "0.0" @@ -171,12 +171,7 @@ yes = 'Glad to hear it! Please tell us how we can improve.' # Adds a reading time to the top of each doc. -# If you want this feature, but occasionally need to remove the Reading time from a single page, +# If you want this feature, but occasionally need to remove the Reading time from a single page, # add "hide_readingtime: true" to the page's front matter [params.ui.readingtime] enable = false - -[[menu.main]] -name = "Functions Catalog" -url = "https://catalog.kpt.dev/function-catalog/" -weight = 40 \ No newline at end of file