« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateNewsEntryPage.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateNewsEntryPage.js')
-rw-r--r--src/content/dependencies/generateNewsEntryPage.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/content/dependencies/generateNewsEntryPage.js b/src/content/dependencies/generateNewsEntryPage.js
index fbd4f609..fa4d68a8 100644
--- a/src/content/dependencies/generateNewsEntryPage.js
+++ b/src/content/dependencies/generateNewsEntryPage.js
@@ -1,3 +1,4 @@
+import {atOffset} from '#sugar';
 import {sortChronologically} from '#wiki-data';
 
 export default {
@@ -22,14 +23,10 @@ export default {
     const index = entries.indexOf(newsEntry);
 
     const previousEntry =
-      (index > 0
-        ? entries[index - 1]
-        : null);
+      atOffset(entries, index, -1);
 
     const nextEntry =
-      (index < entries.length - 1
-        ? entries[index + 1]
-        : null);
+      atOffset(entries, index, +1);
 
     return {previousEntry, nextEntry};
   },