Skip to content

Commit

Permalink
Add PDP metadata script (adobe#72)
Browse files Browse the repository at this point in the history
* Add PDP metadata script

* Add additional metadata fields

* Update hlxignore and add README
  • Loading branch information
herzog31 authored Jul 18, 2024
1 parent f3bc8e8 commit 4b2afc7
Show file tree
Hide file tree
Showing 8 changed files with 427 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ scripts/preact.js
scripts/htm.js
scripts/acdl
tools/picker
tools/pdp-metadata
scripts/dropins
scripts/__dropins__
scripts/commerce-events-collector.js
Expand Down
1 change: 1 addition & 0 deletions .hlxignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ package-lock.json
test/*
postinstall.js
tools/picker/src/*
tools/pdp-metadata/*
1 change: 1 addition & 0 deletions tools/pdp-metadata/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metadata.xlsx
28 changes: 28 additions & 0 deletions tools/pdp-metadata/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# PDP Metadata Generator

## Overview
It is recommended to import product metadata into Edge Delivery so that it can be rendered server-side on product detail pages.
This is important so social media sites which do not parse JavaScript can pick it up.

This project is designed to fetch product data from a catalog service, process it, and generate a metadata spreadsheet in XLSX format which can be used for the https://www.aem.live/docs/bulk-metadata feature in Edge Delivery.

## Prerequisites
- Node.js installed on your machine.
- Access to the catalog service with the necessary API keys and configuration.

## Installation
1. Clone the repository to your local machine.
2. Navigate to the project directory.
3. Run `npm install` to install the dependencies.

## Configuration
Before running the application, you need to ensure the `configFile` variable in `pdp-metadata.js` points to the correct configuration JSON file URL. This file contains the required parameters to access Catalog Service and should have been setup as part of your project onboarding.

## Running the Application
To start the application, run the following command in the terminal:

```bash
npm start
```

This will fetch the product data, process it, and generate a file named `metadata.xlsx` in the project directory.
187 changes: 187 additions & 0 deletions tools/pdp-metadata/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions tools/pdp-metadata/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "pdp-metadata",
"private": true,
"type": "module",
"version": "1.0.0",
"description": "",
"main": "pdp-metadata.js",
"author": "",
"license": "Apache-2.0",
"scripts": {
"start": "node pdp-metadata.js"
},
"dependencies": {
"he": "^1.2.0",
"xlsx": "^0.18.5"
}
}
Loading

0 comments on commit 4b2afc7

Please sign in to comment.