From d83900e2807d1efebf6ffabbc8e827960c5a095c Mon Sep 17 00:00:00 2001 From: oDinZu Date: Sat, 3 Dec 2022 18:45:49 -0500 Subject: [PATCH] if no collections, we need to create a collections dir --- _plugins/jekyll-strapi-api/lib/b-generate-posts.rb | 13 ++++++++++--- .../jekyll-strapi-api/lib/b-generate-products.rb | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/_plugins/jekyll-strapi-api/lib/b-generate-posts.rb b/_plugins/jekyll-strapi-api/lib/b-generate-posts.rb index 9fbc095..c8cb2ad 100644 --- a/_plugins/jekyll-strapi-api/lib/b-generate-posts.rb +++ b/_plugins/jekyll-strapi-api/lib/b-generate-posts.rb @@ -169,11 +169,18 @@ author_ids = parsed_authors_file["data"] Jekyll.logger.debug "::DOCUMENT POST DEBUG:: Raw Content: " "#{content}".to_s.yellow end + # manually create custom collection folders [bug: shouldn't Jekyll do this? https://github.com/jekyll/jekyll/issues/9193] + if not Dir.exist?("./collections") + Jekyll.logger.info "the Jekyll collections directory does not exist, let's create one".to_s.red + Dir.mkdir("./collections/") + Jekyll.logger.info "DIR DEBUG: The local ./collections directory is created at: ./collections".to_s.yellow + end + # manually create custom collection folders [bug: shouldn't Jekyll do this? https://github.com/jekyll/jekyll/issues/9193] if not Dir.exist?("./collections/_posts") - Jekyll.logger.info "the Jekyll posts directory does not exist, let's create one".to_s.red - Dir.mkdir("./collections/_posts/") - Jekyll.logger.info "DIR DEBUG: The local ./collections/_posts directory is created at: ./collections/_posts/".to_s.yellow + Jekyll.logger.info "the Jekyll posts directory does not exist, let's create one".to_s.red + Dir.mkdir("./collections/_posts/") + Jekyll.logger.info "DIR DEBUG: The local ./collections/_posts directory is created at: ./collections/_posts/".to_s.yellow end # create the filename diff --git a/_plugins/jekyll-strapi-api/lib/b-generate-products.rb b/_plugins/jekyll-strapi-api/lib/b-generate-products.rb index 79ee03e..33c1ee0 100644 --- a/_plugins/jekyll-strapi-api/lib/b-generate-products.rb +++ b/_plugins/jekyll-strapi-api/lib/b-generate-products.rb @@ -342,6 +342,13 @@ if "#{shop_enabled}" === "true" Jekyll.logger.debug "::DOCUMENT PRODUCT DEBUG:: is_taxable: " "#{is_taxable}".to_s.yellow.bold end + # manually create custom collection folders [bug: shouldn't Jekyll do this? https://github.com/jekyll/jekyll/issues/9193] + if not Dir.exist?("./collections") + Jekyll.logger.info "the Jekyll collections directory does not exist, let's create one".to_s.red + Dir.mkdir("./collections/") + Jekyll.logger.info "DIR DEBUG: The local ./collections directory is created at: ./collections".to_s.yellow + end + # manually create custom collection folders [bug: shouldn't Jekyll do this? https://github.com/jekyll/jekyll/issues/9193] if not Dir.exist?("./collections/_products") Jekyll.logger.info "the Jekyll products directory does not exist, let's create one".to_s.red