Add RSS Feed extension in head

This change adds a <link> element in the head node of welcome page.
Browsers with extensions for RSS will show a sign to navigate to the feed.
The link changes based on current set filters.
This commit is contained in:
Nikhil Tanwar
2023-02-05 17:27:49 +05:30
parent fa80be87be
commit e3a211e41c
3 changed files with 22 additions and 2 deletions

View File

@ -18,6 +18,17 @@
let timer;
let languages = {};
function updateFeedLink() {
const inputParams = new URLSearchParams(window.location.search);
const filteredParams = new URLSearchParams();
for (const [key, value] of inputParams) {
if ( value != '' ) {
filteredParams.append(key, value);
}
}
document.querySelector('#feed_link').href = `${root}/catalog/v2/entries?${filteredParams.toString()}`;
}
function queryUrlBuilder() {
let url = `${root}/catalog/search?`;
url += Object.keys(incrementalLoadingParams).map(key => `${key}=${incrementalLoadingParams[key]}`).join("&");
@ -363,6 +374,7 @@
setCookie(filterCookieName, params.toString());
}
updateFilterColors();
updateFeedLink();
await loadAndDisplayBooks(true);
}
@ -492,6 +504,7 @@
langFilter.dispatchEvent(new Event('change'));
}
}
updateFeedLink();
setCookie(filterCookieName, params.toString());
}
})();