  useEffect(() => {
    console.error("404 Error: User attempted to access non-existent route:", location.pathname);

    const meta = document.createElement("meta");
    meta.name = "robots";
    meta.content = "noindex";
    document.head.appendChild(meta);

    return () => {
      document.head.removeChild(meta);
    };
  }, [location.pathname]);
