Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

feat: auto suggestions for 404s#133

Open
ekremney wants to merge 4 commits intomainfrom
notfound-suggestions
Open

feat: auto suggestions for 404s#133
ekremney wants to merge 4 commits intomainfrom
notfound-suggestions

Conversation

@ekremney
Copy link
Copy Markdown
Member

@ekremney ekremney commented Mar 8, 2024

Unit tests will follow.

For the detailed documentation/explanation about the logic used to find suggestions, please see https://wiki.corp.adobe.com/display/AEMSites/Auto+Generation+of+Redirect+Targets+for+404+Pages

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 8, 2024

This PR will trigger a minor release when merged.

Copy link
Copy Markdown

@blefebvre blefebvre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great idea. Any rate limit concerns with the Google API?

Comment thread src/support/notfound.js
const query = getSuggestionQuery(url);
const resp = await fetch(`${SEARCH_ENGINE_BASE_URL}?cx=${searchEngineId}&key=${searchEngineKey}&q=${encodeURIComponent(query)}`);
if (!resp.ok) {
throw new Error(`Google API returned unsuccessful response ${resp.status}`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be helpful to have the query included in this error message?

Comment thread src/support/notfound.js
// send alert to the Slack channel - group under a thread if ts value exists
await slackClient.fileUpload({
thread_ts: slackContext?.thread_ts,
channel_id: slackContext?.channel,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If slackContext is undefined, where will the file be uploaded to?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants