mirror of
https://github.com/goenning/google-indexing-script.git
synced 2024-11-25 08:43:02 +03:00
update with prettier
This commit is contained in:
parent
177a8f1daf
commit
5632c342ca
@ -95,7 +95,7 @@ export const index = async (input: string = process.argv[2], options: IndexOptio
|
||||
pages = checkCustomUrls(siteUrl, pages);
|
||||
console.log(`👉 Found ${pages.length} URLs in the provided list`);
|
||||
}
|
||||
|
||||
|
||||
const statusPerUrl: Record<string, { status: Status; lastCheckedAt: string }> = existsSync(cachePath)
|
||||
? JSON.parse(readFileSync(cachePath, "utf8"))
|
||||
: {};
|
||||
@ -123,7 +123,7 @@ export const index = async (input: string = process.argv[2], options: IndexOptio
|
||||
const shouldRecheck = (status: Status, lastCheckedAt: string) => {
|
||||
const shouldIndexIt = indexableStatuses.includes(status);
|
||||
const isOld = new Date(lastCheckedAt) < new Date(Date.now() - CACHE_TIMEOUT);
|
||||
return shouldIndexIt && isOld;;
|
||||
return shouldIndexIt && isOld;
|
||||
};
|
||||
|
||||
await batch(
|
||||
|
@ -130,7 +130,7 @@ export async function checkSiteUrl(accessToken: string, siteUrl: string) {
|
||||
export function checkCustomUrls(siteUrl: string, urls: string[]) {
|
||||
const protocol = siteUrl.startsWith("http://") ? "http://" : "https://";
|
||||
const domain = siteUrl.replace("https://", "").replace("http://", "").replace("sc-domain:", "");
|
||||
const formattedUrls: string[] = urls.map((url) =>{
|
||||
const formattedUrls: string[] = urls.map((url) => {
|
||||
url = url.trim();
|
||||
if (url.startsWith("/")) {
|
||||
// the url is a relative path (e.g. /about)
|
||||
@ -143,7 +143,7 @@ export function checkCustomUrls(siteUrl: string, urls: string[]) {
|
||||
return `${protocol}${url}`;
|
||||
} else {
|
||||
// the url is a relative path without the leading slash (e.g. about)
|
||||
return `${protocol}${domain}/${url}`
|
||||
return `${protocol}${domain}/${url}`;
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user