 CREATE FUNCTION public.page_menu_after() RETURNS trigger AS $$
     DECLARE
         _ext text := '.html';
+        _index text := 'index';
         _pad int := 10;
     BEGIN
         -- No relevant changes


CREATE TRIGGER
    page_menu_before
BEFORE INSERT OR UPDATE ON
    public.page
FOR EACH ROW WHEN (pg_trigger_depth() < 1) EXECUTE PROCEDURE
    public.page_menu_before();

CREATE TRIGGER
    page_menu_after
AFTER INSERT OR UPDATE OR DELETE ON
    public.page
FOR EACH ROW WHEN (pg_trigger_depth() < 1) EXECUTE PROCEDURE
    public.page_menu_after();

--

        t AS (
            SELECT
                p.id,
                CASE WHEN p.slug = _index THEN '' ELSE '/' || p.slug END AS urlkey,
                CASE WHEN p.slug = _index THEN '/' ELSE '/' || p.slug || _ext END AS url,
                p.menu,
                s.sort,
                LPAD(cast(s.sort AS text), _pad, '0') AS position,
