diff --git a/config.toml b/config.toml index 86757671..031fba51 100644 --- a/config.toml +++ b/config.toml @@ -26,6 +26,7 @@ is_netlify = true language_code = "en-US" theme_color = "#fff" +ganalytics = "___GANALYTICS___" timeformat = "%B %e, %Y" timezone = "___TIMEZONE___" diff --git a/convert.py b/convert.py index 99ae4f41..39358cf8 100644 --- a/convert.py +++ b/convert.py @@ -16,6 +16,7 @@ "LANDING_DESCRIPTION": "I have nothing but intelligence.", "LANDING_BUTTON": "Steal some of my intelligence", "SORT_BY": "title", + "GANALYTICS": "", } ZOLA_DIR = Path(__file__).resolve().parent @@ -46,7 +47,7 @@ def step1(): raise NotFoundErr(f"FATAL ERROR: build.environment.{item} not set!") else: print( - f"WARNING: build.environment.{item} not set! Defaulting to {def_val}" + f"WARNING: build.environment.{item} not set! Defaulting to '{def_val}'." ) environ[item] = def_val else: @@ -75,9 +76,9 @@ def step3(): """ print_step("GENERATING _index.md") - sections = list(DOCS_DIR.glob("**/**")) + sections = list(sorted(DOCS_DIR.glob("**/**"), key=lambda x: str(x).lower())) content = None - for section in sections: + for idx, section in enumerate(sections): # Set section title as relative path to section title = re.sub(r"^.*?content/docs/*", "", str(section)) @@ -97,6 +98,7 @@ def step3(): f"title: {title}", "template: docs/section.html", f"sort_by: {sort_by}", + f"weight: {idx}", "---", ] open(section / "_index.md", "w").write("\n".join(content)) diff --git a/netlify.example.toml b/netlify.example.toml index 2149872a..2960c79c 100644 --- a/netlify.example.toml +++ b/netlify.example.toml @@ -21,5 +21,7 @@ SITE_URL = "" # Site Timezone TIMEZONE = "Asia/Hong_Kong" ZOLA_VERSION = "0.15.2" -# How to sort notes on the right sidebar ("date" or "title"), defaults to "title" if missing or invalid +# How to sort notes inside each section on the right sidebar ("date" or "title"), defaults to "title" if missing or invalid (subsections are sorted by title, the sort order cannot be changed) SORT_BY = "title" +# Google Analytics Measurement ID +GANALYTICS = ""