Skip to content

Remove prev next from navigation #946

Closed

Description

@chuegel

Hi,

how can I remove prev/next items from navigation? Is there a option in mkdocs.yml ?

Activity

  1. waylan commented on May 24, 2016

    @waylan
    Contributor

    Have a l look at #633 in which the include_next_prev config option is being deprecated (which explains why it is not documented). As noted in the last comment on that issue, users should remove the next/prev links via theme customization as discussed in #607.

  2. gringolalia commented on Oct 1, 2016

    @gringolalia

    Could you provide a quick step-by-step? I do not understand! Where are the theme files and templates located and how can I edit them? Newbie sorry.

  3. waylan commented on Oct 2, 2016

    @waylan
    Contributor

    @gringolalia you don't "edit" the templates, but you override them either through replacement files or through template inheritance. However, the mechanisms for doing that are not fully implemented in the current release (0.15), but will be in the next release (0.16). That release will also include extensive documentation about how to override various parts of the templates. For a preview, you can view the pending updates to the documentation here: https://github.com/mkdocs/mkdocs/blob/master/docs/user-guide/styling-your-docs.md#customizing-a-theme. Note that "Template Blocks" are completely missing from version 0.15 (they hadn't been implemented yet) and some of the other stuff has been tweaked a little since that release. In other words, those are the docs for the new upcoming features. Things currently don't work exactly that way (mostly but not quite), but its the best we have. Hopefully the next release will happen soon and everything will work as documented there.

  4. bretonio commented on Oct 2, 2016

    @bretonio

    Looking forward to it thx!

  5. hasufell commented on Oct 13, 2021

    @hasufell

    Came here, because I want to remove these links as well. https://github.com/mkdocs/mkdocs/blob/master/docs/user-guide/styling-your-docs.md#customizing-a-theme is a dead link. Also saw #663 and 4a532be which I both don't understand.

  6. oprypin commented on Oct 13, 2021

    @oprypin
  7. hasufell commented on Oct 13, 2021

    @hasufell

    That throws errors:

    Traceback (most recent call last):
      File "/home/hasufell/.local/bin/mkdocs", line 8, in <module>
        sys.exit(cli())
      File "/usr/lib/python3.9/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/usr/lib/python3.9/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/usr/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/lib/python3.9/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/hasufell/.local/lib/python3.9/site-packages/mkdocs/__main__.py", line 133, in serve_command
        serve.serve(
      File "/home/hasufell/.local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 141, in serve
        config = builder()
      File "/home/hasufell/.local/lib/python3.9/site-packages/mkdocs/commands/serve.py", line 136, in builder
        build(config, live_server=live_server, dirty=dirty)
      File "/home/hasufell/.local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 285, in build
        _build_theme_template(template, env, files, config, nav)
      File "/home/hasufell/.local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 108, in _build_theme_template
        output = _build_template(template_name, template, files, config, nav)
      File "/home/hasufell/.local/lib/python3.9/site-packages/mkdocs/commands/build.py", line 87, in _build_template
        output = template.render(context)
      File "/home/hasufell/.local/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
        self.environment.handle_exception()
      File "/home/hasufell/.local/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
        reraise(*rewrite_traceback_stack(source=source))
      File "/home/hasufell/.local/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
        raise value.with_traceback(tb)
      File "/home/hasufell/.local/lib/python3.9/site-packages/mkdocs/themes/mkdocs/404.html", line 1, in top-level template code
        {% extends "base.html" %}
      File "/home/hasufell/.local/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
        reraise(*rewrite_traceback_stack(source=source))
      File "/home/hasufell/.local/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
        raise value.with_traceback(tb)
      File "/home/hasufell/git/ghcup-hs/docs/overrides/base.html", line 116, in template
        <i class="fa fa-search"></i> {% trans %}Search{% endtrans %}
    jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'trans'. Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The innermost block that needs to be closed is 'if'.
    
  8. oprypin commented on Oct 13, 2021

    @oprypin
  9. hasufell commented on Oct 13, 2021

    @hasufell

    OK so... you're doing something (we don't know what) and you're getting errors.

    All I did was download

    {%- block next_prev %}
    into the override folder, which is otherwise empty and ran mkdocs serve.

    The theme config is this:

    theme:
        name: mkdocs
        locale: en
        custom_dir: docs/overrides
    

    mkdocs version is 1.1.2.

  10. oprypin commented on Oct 13, 2021

    @oprypin
  11. oprypin commented on Oct 13, 2021

    @oprypin
  12. hasufell commented on Oct 13, 2021

    @hasufell
    pip install --user --upgrade mkdocs

    Fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions