diff --git a/mkdocs/nav.py b/mkdocs/nav.py
index 5a215b28..ee7d6b34 100644
--- a/mkdocs/nav.py
+++ b/mkdocs/nav.py
@@ -224,6 +224,13 @@ def _generate_site_navigation(pages_config, url_context, use_directory_urls=True
             filename = path.split(os.path.sep)[0]
             title = filename_to_title(filename)
 
+        # If we don't have a child title but the other title is the same, we
+        # should be within a section and the child title needs to be inferred
+        # from the filename.
+        if len(nav_items) and title == nav_items[-1].title == title and child_title is None:
+            filename = path.split(os.path.sep)[-1]
+            child_title = filename_to_title(filename)
+
         url = utils.get_url_path(path, use_directory_urls)
 
         if not child_title:

Regression when building docs
I got this when building the Django REST Framework docs with 0.12.1

    $ mkdocs build 
    Building documentation to directory: site
    Directory site contains stale files. Use --clean to remove them.
    Traceback (most recent call last):
      File "/home/dougalmatthews/.virtualenvs/mkdocs/bin/mkdocs", line 9, in <module>
        load_entry_point('mkdocs==0.12.1', 'console_scripts', 'mkdocs')()
      File "/home/dougalmatthews/.virtualenvs/mkdocs/lib/python2.7/site-packages/mkdocs/main.py", line 77, in run_main
        main(cmd, args=sys.argv[2:], options=dict(opts))
      File "/home/dougalmatthews/.virtualenvs/mkdocs/lib/python2.7/site-packages/mkdocs/main.py", line 52, in main
        build(config, clean_site_dir=clean_site_dir)
      File "/home/dougalmatthews/.virtualenvs/mkdocs/lib/python2.7/site-packages/mkdocs/build.py", line 252, in build
        build_pages(config)
      File "/home/dougalmatthews/.virtualenvs/mkdocs/lib/python2.7/site-packages/mkdocs/build.py", line 209, in build_pages
        site_navigation = nav.SiteNavigation(config['pages'], config['use_directory_urls'])
      File "/home/dougalmatthews/.virtualenvs/mkdocs/lib/python2.7/site-packages/mkdocs/nav.py", line 37, in __init__
        _generate_site_navigation(pages_config, self.url_context, use_directory_urls)
      File "/home/dougalmatthews/.virtualenvs/mkdocs/lib/python2.7/site-packages/mkdocs/nav.py", line 243, in _generate_site_navigation
        header.children.append(page)
    AttributeError: 'Page' object has no attribute 'children'

diff --git a/mkdocs/tests/nav_tests.py b/mkdocs/tests/nav_tests.py
index 4e8531cd..cdd2bf9f 100644
--- a/mkdocs/tests/nav_tests.py
+++ b/mkdocs/tests/nav_tests.py
@@ -63,6 +63,30 @@ class SiteNavigationTests(unittest.TestCase):
         self.assertEqual(len(site_navigation.nav_items), 3)
         self.assertEqual(len(site_navigation.pages), 6)
 
+    def test_indented_toc_missing_child_title(self):
+        pages = [
+            ('index.md', 'Home'),
+            ('api-guide/running.md', 'API Guide', 'Running'),
+            ('api-guide/testing.md', 'API Guide'),
+            ('api-guide/debugging.md', 'API Guide', 'Debugging'),
+            ('about/release-notes.md', 'About', 'Release notes'),
+            ('about/license.md', 'About', 'License')
+        ]
+        expected = dedent("""
+        Home - /
+        API Guide
+            Running - /api-guide/running/
+            Testing - /api-guide/testing/
+            Debugging - /api-guide/debugging/
+        About
+            Release notes - /about/release-notes/
+            License - /about/license/
+        """)
+        site_navigation = nav.SiteNavigation(pages)
+        self.assertEqual(str(site_navigation).strip(), expected)
+        self.assertEqual(len(site_navigation.nav_items), 3)
+        self.assertEqual(len(site_navigation.pages), 6)
+
     def test_nested_ungrouped(self):
         pages = [
             ('index.md', 'Home'),

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest mock click
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
click==8.1.8
exceptiongroup==1.2.2
ghp-import==2.1.0
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
livereload==2.7.1
Markdown==3.7
MarkupSafe==3.0.2
-e git+https://github.com/mkdocs/mkdocs.git@852996e7e1e17e83ac650a5c5be6834323cca94e#egg=mkdocs
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
python-dateutil==2.9.0.post0
PyYAML==6.0.2
six==1.17.0
tomli==2.2.1
tornado==6.4.2
zipp==3.21.0

name: mkdocs
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - click==8.1.8
      - exceptiongroup==1.2.2
      - ghp-import==2.1.0
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - jinja2==3.1.6
      - livereload==2.7.1
      - markdown==3.7
      - markupsafe==3.0.2
      - mock==5.2.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - pyyaml==6.0.2
      - six==1.17.0
      - tomli==2.2.1
      - tornado==6.4.2
      - zipp==3.21.0
prefix: /opt/conda/envs/mkdocs

mkdocs/tests/nav_tests.py::SiteNavigationTests::test_indented_toc_missing_child_title
mkdocs/tests/nav_tests.py::SiteNavigationTests::test_ancestors mkdocs/tests/nav_tests.py::SiteNavigationTests::test_base_url mkdocs/tests/nav_tests.py::SiteNavigationTests::test_empty_toc_item mkdocs/tests/nav_tests.py::SiteNavigationTests::test_generate_site_navigation mkdocs/tests/nav_tests.py::SiteNavigationTests::test_generate_site_navigation_windows mkdocs/tests/nav_tests.py::SiteNavigationTests::test_indented_toc mkdocs/tests/nav_tests.py::SiteNavigationTests::test_invalid_pages_config mkdocs/tests/nav_tests.py::SiteNavigationTests::test_nested_ungrouped mkdocs/tests/nav_tests.py::SiteNavigationTests::test_nested_ungrouped_no_titles mkdocs/tests/nav_tests.py::SiteNavigationTests::test_nested_ungrouped_no_titles_windows mkdocs/tests/nav_tests.py::SiteNavigationTests::test_relative_md_links_have_slash mkdocs/tests/nav_tests.py::SiteNavigationTests::test_simple_toc mkdocs/tests/nav_tests.py::SiteNavigationTests::test_walk_empty_toc mkdocs/tests/nav_tests.py::SiteNavigationTests::test_walk_indented_toc mkdocs/tests/nav_tests.py::SiteNavigationTests::test_walk_simple_toc
mkdocs/nav.py
mkdocs/nav.py