fix: questionLanding function params is null render error

This commit is contained in:
shuai 2023-04-10 11:17:43 +08:00
parent 68aa0f66bb
commit db53a5b5a2
2 changed files with 3 additions and 1 deletions

View File

@ -144,7 +144,6 @@ export function htmlRender(el: HTMLElement | null) {
// add rel nofollow for link not inlcludes domain
el.querySelectorAll('a').forEach((a) => {
if (a?.href?.includes('http')) return;
const base = window.location.origin;
const targetUrl = new URL(a.href, base);
if (targetUrl.toString() !== window.location.href) {

View File

@ -19,6 +19,9 @@ const tagEdit = (tagId: string) => {
};
const questionLanding = (questionId: string, slugTitle: string = '') => {
const { seo } = seoSettingStore.getState();
if (!questionId) {
return slugTitle ? `/questions/null/slugTitle` : '/questions/null';
}
// @ts-ignore
if (/[13]/.test(seo.permalink) && slugTitle) {
return urlcat('/questions/:questionId/:slugPermalink', {