You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having post_link and post_path return nothing if the provided slug does not exist makes it easy to accidentally create dead links on your site.
It was previously suggested that this should throw an error in #1594, which was closed as a dupe of #1771, but it doesn't look like this was ever implemented as part of the latter ticket, nor can I find any further discussion about it.
Reproduction case
hexo init test-site
cd test-site
echo "{% post_link 'hello-world' %}{% post_link 'hello-world-nonexistent' %}" >> source/_posts/hello-world.md
hexo server --open
The server output only contains:
~/Desktop/tmp/test-site $ hexo server --open
INFO Start processing
INFO Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
and the page renders with only the first link (which has a valid slug). I think it would be much safer if an error or warning was printed in the server log.
#1771 is only on formatting, it does not intend to modify logic of when to generate an error.
I think I misread the proposed solution as code snippet in Hexo code base. It should NOT have been marked as duplicate in the first place.
Closing this one and reopen #1594.
Having
post_link
andpost_path
return nothing if the provided slug does not exist makes it easy to accidentally create dead links on your site.It was previously suggested that this should throw an error in #1594, which was closed as a dupe of #1771, but it doesn't look like this was ever implemented as part of the latter ticket, nor can I find any further discussion about it.
Reproduction case
The server output only contains:
and the page renders with only the first link (which has a valid slug). I think it would be much safer if an error or warning was printed in the server log.
Environment Info
The text was updated successfully, but these errors were encountered: