Repository: gradio-app/gradio
File: gradio/blocks.py (Python)

Code before:
            block = original_mapping.get(target_id)
            # Blocks events are a special case because they are not stored in the blocks list in the config
            if block is None:
                if event_name in [
                    event.event_name if isinstance(event, EventListener) else event
                    for event in BLOCKS_EVENTS
                ]:
                    block = Context.root_block
                else:
                    raise ValueError(
                        f"Cannot find Block with id: {target_id} but is present as a target in the config"
                    )
            event = getattr(block, event_name)
            target_events.append(event)
        return target_events

    @document()
    def route(
        self, name: str, path: str | None = None, show_in_navbar: bool = True
    ) -> Blocks:
        """
        Adds a new page to the Blocks app.
        Parameters:
            name: The name of the page as it appears in the nav bar.
            path: The URL suffix appended after your Gradio app's root URL to access this page (e.g. if path="/test", the page may be accessible e.g. at http://localhost:7860/test). If not provided, the path is generated from the name by converting to lowercase and replacing spaces with hyphens. Any leading or trailing forward slashes are stripped.
            show_in_navbar: If True, the page will appear in the navbar. If False, the page will be accessible via URL but not shown in the navbar. Defaults to True.
        Example:
            with gr.Blocks() as demo:
                name = gr.Textbox(label="Name")
                ...
            with demo.route("Test", "/test"):
                num = gr.Number()
                ...
        """
        if get_blocks_context():
            raise ValueError(
                "You cannot create a route while inside a Blocks() context. Call route() outside the Blocks() context (unindent this line)."
            )

        if path:
            path = path.strip("/")
            valid_path_regex = re.compile(r"^[a-zA-Z0-9-._~!$&'()*+,;=:@\[\]]+$")
            if not valid_path_regex.match(path):
                raise ValueError(
                    f"Path '{path}' contains invalid characters. Paths can only contain alphanumeric characters and the following special characters: -._~!$&'()*+,;=:@[]"
                )
        if path in INTERNAL_ROUTES:
            raise ValueError(f"Route with path '{path}' already exists")
        if path is None:
            path = name.lower().replace(" ", "-")
            path = "".join(

Review comment (suggestion):
```suggestion
            show_in_navbar: If True, the page will appear in the navbar. If False, the page will be accessible via URL but not shown in the navbar.
```

Code after:
            block = original_mapping.get(target_id)
            # Blocks events are a special case because they are not stored in the blocks list in the config
            if block is None:
                if event_name in [
                    event.event_name if isinstance(event, EventListener) else event
                    for event in BLOCKS_EVENTS
                ]:
                    block = Context.root_block
                else:
                    raise ValueError(
                        f"Cannot find Block with id: {target_id} but is present as a target in the config"
                    )
            event = getattr(block, event_name)
            target_events.append(event)
        return target_events

    @document()
    def route(
        self, name: str, path: str | None = None, show_in_navbar: bool = True
    ) -> Blocks:
        """
        Adds a new page to the Blocks app.
        Parameters:
            name: The name of the page as it appears in the nav bar.
            path: The URL suffix appended after your Gradio app's root URL to access this page (e.g. if path="/test", the page may be accessible e.g. at http://localhost:7860/test). If not provided, the path is generated from the name by converting to lowercase and replacing spaces with hyphens. Any leading or trailing forward slashes are stripped.
            show_in_navbar: If True, the page will appear in the navbar. If False, the page will be accessible via URL but not shown in the navbar.
        Example:
            with gr.Blocks() as demo:
                name = gr.Textbox(label="Name")
                ...
            with demo.route("Test", "/test"):
                num = gr.Number()
                ...
        """
        if get_blocks_context():
            raise ValueError(
                "You cannot create a route while inside a Blocks() context. Call route() outside the Blocks() context (unindent this line)."
            )

        if path:
            path = path.strip("/")
            valid_path_regex = re.compile(r"^[a-zA-Z0-9-._~!$&'()*+,;=:@\[\]]+$")
            if not valid_path_regex.match(path):
                raise ValueError(
                    f"Path '{path}' contains invalid characters. Paths can only contain alphanumeric characters and the following special characters: -._~!$&'()*+,;=:@[]"
                )
        if path in INTERNAL_ROUTES:
            raise ValueError(f"Route with path '{path}' already exists")
        if path is None:
            path = name.lower().replace(" ", "-")
            path = "".join(