Skip to content

Commit

Permalink
Merge pull request #4 from PLG-Works/roy-cse-patch-1
Browse files Browse the repository at this point in the history
Added Breadcrumb ld+json to root index file
  • Loading branch information
bala007 authored Aug 23, 2022
2 parents 986a6fc + 55e4063 commit d55b7f4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
13 changes: 13 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "/<script type=\"application\/ld+json\">/i\
<script type=\"application/ld+json\">${BREADCRUMB_ROOT_INDEX_JSONLD}</script>" ${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 *****"
Expand Down

0 comments on commit d55b7f4

Please sign in to comment.