diff --git a/.env.sample b/.env.sample index 096468c..1ab23e8 100644 --- a/.env.sample +++ b/.env.sample @@ -9,5 +9,7 @@ AWS_DEFAULT_REGION=us-east-1 CUSTOM_REPLACE_KEYS="key_1", "key_2" CUSTOM_REPLACE_VALUES="value_1", "value_2" -# To replace ld+json data for the root index file use following variable +# To replace ld+json data in the root index file use following variable ROOT_INDEX_JSONLD={"@context":"http://schema.org","@type":"Organization"} +# To add breadcrumb ld+json data in the root index file use following variable +BREADCRUMB_ROOT_INDEX_JSONLD={"@context":"https://schema.org","@type":"BreadcrumbList"} diff --git a/README.md b/README.md index f45d0b2..36b3961 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,12 @@ Additionally, it also provides the functionality to upload the static HTML files ## `root_index_jsonld` -**Optional** ld+json data for the root index file. +**Optional** Replace ld+json data in the root index file. + + +## `breadcrumb_root_index_jsonld` + +**Optional** Add Breadcrumb ld+json data in the root index file. ## `s3_bucket_name` diff --git a/action.yml b/action.yml index 62a95ed..1aad0bc 100644 --- a/action.yml +++ b/action.yml @@ -17,7 +17,10 @@ inputs: description: "Comma separated associated values for the item in custom_replace_keys" required: false root_index_jsonld: - description: "ld+json data for the root index file" + description: "Replace ld+json data in the root index file" + required: false + breadcrumb_root_index_jsonld: + description: "Add breadcrumb ld+json data to the root index file" required: false s3_bucket_name: description: "S3 bucket name to upload static HTML files" @@ -40,6 +43,7 @@ runs: - ${{ inputs.custom_replace_keys }} - ${{ inputs.custom_replace_values }} - ${{ inputs.root_index_jsonld }} + - ${{ inputs.breadcrumb_root_index_jsonld }} - ${{ inputs.s3_bucket_name }} - ${{ inputs.aws_access_key_id }} - ${{ inputs.aws_secret_access_key }} diff --git a/entrypoint.sh b/entrypoint.sh index cd2b0c8..7d5a201 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,6 +6,7 @@ if [[ $# -gt 0 && ${GITHUB_ACTIONS} -eq true ]]; then export CUSTOM_REPLACE_KEYS=${INPUT_CUSTOM_REPLACE_KEYS} export CUSTOM_REPLACE_VALUES=${INPUT_CUSTOM_REPLACE_VALUES} export ROOT_INDEX_JSONLD=${INPUT_ROOT_INDEX_JSONLD} + export BREADCRUMB_ROOT_INDEX_JSONLD=${INPUT_BREADCRUMB_ROOT_INDEX_JSONLD} export S3_BUCKET_NAME=${INPUT_S3_BUCKET_NAME} export AWS_ACCESS_KEY_ID=${INPUT_AWS_ACCESS_KEY_ID} export AWS_SECRET_ACCESS_KEY=${INPUT_AWS_SECRET_ACCESS_KEY} diff --git a/run.sh b/run.sh index 5ecf71d..cefaba5 100755 --- a/run.sh +++ b/run.sh @@ -8,6 +8,7 @@ # - CUSTOM_REPLACE_KEYS (comma separated list of items that needs to be replaced from the items in CUSTOM_REPLACE_VALUES at the same index) # - CUSTOM_REPLACE_VALUES (associated values for the item in CUSTOM_REPLACE_KEYS) # - ROOT_INDEX_JSONLD (LD+JSON data that needs to be replaced in root index.html page) +# - BREADCRUMB_ROOT_INDEX_JSONLD (Breadcrumb LD+JSON data that needs to be added in root index.html page) # - S3_BUCKET_NAME (S3 bucket name to upload static HTML files) # - AWS_ACCESS_KEY_ID # - AWS_SECRET_ACCESS_KEY @@ -118,6 +119,18 @@ if [[ ! -z "${ROOT_INDEX_JSONLD}" ]]; then echo "***** ld+json data replaced in index.html *****" fi + +if [[ ! -z "${BREADCRUMB_ROOT_INDEX_JSONLD}" ]]; then + echo " " + echo "***** Adding Breadcrumb ld+json data in index.html *****" + + sed "/" ${blog_dir}/index.html >${blog_dir}/_index.html + mv -f ${blog_dir}/_index.html ${blog_dir}/index.html + + echo "***** Breadcrumb ld+json data added in index.html *****" +fi + if [[ ! -z ${S3_BUCKET_NAME} ]]; then echo " " echo "***** Started uploading files to S3 *****"