diff --git a/my-blog/static/index.html b/my-blog/static/index.html index d6aef90..0392639 100644 --- a/my-blog/static/index.html +++ b/my-blog/static/index.html @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/my-blog/templates/oauth-assets.html b/my-blog/templates/oauth-assets.html index d6aef90..0392639 100644 --- a/my-blog/templates/oauth-assets.html +++ b/my-blog/templates/oauth-assets.html @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/oauth/src/App.tsx b/oauth/src/App.tsx index b81c161..82334ab 100644 --- a/oauth/src/App.tsx +++ b/oauth/src/App.tsx @@ -302,13 +302,13 @@ function App() { const langData = await langResponse.json(); const langRecords = langData.records || []; - // Filter by current page path if on post page + // Filter by current page rkey if on post page const filteredLangRecords = appConfig.rkey ? langRecords.filter(record => { - // Compare path only, not full URL to support localhost vs production - const recordPath = record.value.post?.url ? new URL(record.value.post.url).pathname : - record.value.url ? new URL(record.value.url).pathname : ''; - return recordPath === window.location.pathname; + // Compare rkey only (last part of path) + const recordRkey = record.value.post?.url ? new URL(record.value.post.url).pathname.split('/').pop() : ''; + const currentRkey = window.location.pathname.split('/').pop(); + return recordRkey === currentRkey; }) : langRecords.slice(0, 3); // Top page: latest 3 @@ -321,13 +321,13 @@ function App() { const commentData = await commentResponse.json(); const commentRecords = commentData.records || []; - // Filter by current page path if on post page + // Filter by current page rkey if on post page const filteredCommentRecords = appConfig.rkey ? commentRecords.filter(record => { - // Compare path only, not full URL to support localhost vs production - const recordPath = record.value.post?.url ? new URL(record.value.post.url).pathname : - record.value.url ? new URL(record.value.url).pathname : ''; - return recordPath === window.location.pathname; + // Compare rkey only (last part of path) + const recordRkey = record.value.post?.url ? new URL(record.value.post.url).pathname.split('/').pop() : ''; + const currentRkey = window.location.pathname.split('/').pop(); + return recordRkey === currentRkey; }) : commentRecords.slice(0, 3); // Top page: latest 3