diff --git a/lib.php b/lib.php
index 0a0086b864134c91cf988b84775776559456bf1d..ec419cbd2b928baf6d63635a6be345dc352eaa0a 100644
--- a/lib.php
+++ b/lib.php
@@ -27,6 +27,13 @@ define('LOCALHSHEXPORT_NAV_PARTICIPANTS', 'navpart');
 
 
 function local_hshexport_extend_navigation_course($navigation, $course, $context) {
+    global $PAGE, $SITE;
+
+    // Only add this settings item on non-site course pages.
+    if (!$PAGE->course or $PAGE->course->id == $SITE->id) {
+        return;
+    }
+
     if (has_capability('local/hshexport:canexport', $context)) {
         // Create the navigation node.
         $url = new moodle_url('/local/hshexport/export.php', ['id' => $course->id]);