def on_config(self, config: MkDocsConfig, **kwargs) -> MkDocsConfig:
        """Add plugin templates and scripts to config."""
        if config.theme.get('include_search_page'):
            config.theme.static_templates.add('search.html')
        if not config.theme.get('search_index_only'):
            path = os.path.join(base_path, 'templates')
            config.theme.dirs.append(path)
            if 'search/main.js' not in config.extra_javascript:
                config.extra_javascript.append('search/main.js')  # type: ignore
        if self.config.lang is None:
            # lang setting undefined. Set default based on theme locale
            validate = _PluginConfig.lang.run_validation
            self.config.lang = validate(config.theme.locale.language)
        # The `python` method of `prebuild_index` is pending deprecation as of version 1.2.
        # TODO: Raise a deprecation warning in a future release (1.3?).
        if self.config.prebuild_index == 'python':
            log.info(
                "The 'python' method of the search plugin's 'prebuild_index' config option "
                "is pending deprecation and will not be supported in a future release."
            )
        return config
Add plugin templates and scripts to config.
mkdocs/contrib/search/__init__.py