This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: auto suggestions for 404s #133
Open
ekremney
wants to merge
4
commits into
main
Choose a base branch
from
notfound-suggestions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR will trigger a minor release when merged. |
blefebvre
reviewed
Mar 12, 2024
There was a problem hiding this 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?
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}`); |
There was a problem hiding this comment.
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?
// 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, |
There was a problem hiding this comment.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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