diff --git a/en/asgardeo/features.json b/en/asgardeo/features.json new file mode 100644 index 0000000000..4d55f436af --- /dev/null +++ b/en/asgardeo/features.json @@ -0,0 +1,19 @@ +{ + "asgardeo_logs": { + "enabled": true, + "page": [ + "guides/asgardeo-logs/index.md", + "guides/asgardeo-logs/diagnostic-logs.md", + "guides/asgardeo-logs/audit-logs.md" + ] + }, + + "applications": { + "enabled": true, + "page": [ + "guides/applications/register-single-page-app.md", + "guides/applications/register-oidc-web-app.md", + "guides/applications/register-saml-web-app.md" + ] + } +} diff --git a/en/asgardeo/hooks.py b/en/asgardeo/hooks.py new file mode 100644 index 0000000000..6cc462c786 --- /dev/null +++ b/en/asgardeo/hooks.py @@ -0,0 +1,53 @@ +import os +import json +from mkdocs.structure.nav import Section, Page, Link + +def parse_json(file_path): + features_to_remove = {"feature": {}, "page": []} + with open(file_path, 'r') as json_file: + parse_data = json.load(json_file) + for feature, details in parse_data.items(): + enabled = details['enabled'] + page = details['page'] + features_to_remove['feature'][feature] = enabled + + if not enabled: + features_to_remove['page'].extend(page) + json_file.close() + return features_to_remove + +files_to_remove = parse_json(os.path.join(os.getcwd(), 'features.json')) + +def on_files(files, config): + for file in list(files): + if file.src_uri in files_to_remove['page']: + files.remove(file) + return files + +def remove_nav_item(nav_items): + filtered_items = [] + + for item in nav_items: + if isinstance(item, dict): + if any(page in item.values() for page in files_to_remove['page']): + continue + for key, value in item.items(): + if isinstance(value, list): + value = remove_nav_item(value) + item[key] = value + item = {k: v for k, v in item.items() if not (isinstance(v, list) and not v)} + if item: + filtered_items.append(item) + elif isinstance(item, list): + if item: + filtered_items.append(item) + + return filtered_items + +def on_config(config): + + for feature, enabled in files_to_remove['feature'].items(): + config[feature] = enabled + + config['nav'] = remove_nav_item(config['nav']) + return config diff --git a/en/asgardeo/mkdocs.yml b/en/asgardeo/mkdocs.yml index 69d1335ef8..2481d9841f 100644 --- a/en/asgardeo/mkdocs.yml +++ b/en/asgardeo/mkdocs.yml @@ -94,6 +94,9 @@ watch: - ../theme/material - ../base.yml +hooks: + - hooks.py + plugins: - search - markdownextradata: {} @@ -125,12 +128,25 @@ plugins: 'apis/oauth-dcr.md' : 'apis/dynamic-client-registration-rest-api.md' '/guides/authorization/impersonation/user-impersonation/' : '/guides/authorization/user-impersonation/' +exclude_docs: | + /get-started/hello-world.md + +not_in_nav: | + /page-not-found.md + /get-started/explore-asgardeo.md + /get-started/start-integrating-apps.md + /get-started/try-samples/index.md + /get-started/try-your-own-app/index.md + /get-started/try-your-own-app/angular.md + /get-started/hello-world.md + # Navigation nav: - Home: - Home: index.md - Get Started: - Get Started - Overview: get-started/index.md + - Hello world: get-started/hello-world.md - Create your Asgardeo account: get-started/create-asgardeo-account.md - Try login with Asgardeo: get-started/try-it-application.md - Start integrating Asgardeo into apps: diff --git a/en/asgardeo/requirements.txt b/en/asgardeo/requirements.txt index 287caf7b03..a3849ac591 100644 --- a/en/asgardeo/requirements.txt +++ b/en/asgardeo/requirements.txt @@ -1,4 +1,4 @@ -mkdocs==1.5.3 +mkdocs==1.6.1 Pygments==2.14.0 pymdown-extensions==10.3.1 mkdocs-minify-plugin==0.6.2 @@ -6,10 +6,12 @@ mkdocs-markdownextradata-plugin==0.2.5 mkdocs-redirects==1.2.0 pathlib==1.0.1 mkdocs-material==9.1.2 -markdown==3.2.1 +markdown==3.3.6 mkdocs-redirects==1.2.0 mkdocs-exclude==1.0.2 markdown-include==0.8.1 jinja2==3.1.2 mkdocs-glightbox==0.3.4 -mkdocs-include-markdown-plugin==6.0.0 \ No newline at end of file +mkdocs-include-markdown-plugin==6.0.0 +mkdocs-macros-plugin==1.2.0 +mkdocs-exclude==1.0.2