{% set canonical = page.canonical_url | string %} {% set is_zh = "/zh/" in canonical %} {% set home_url = "zh/" if is_zh else "en/" %} {% set is_docs = "/docs/" in canonical or "/development/" in canonical or "/modules/" in canonical %} {% set is_docs_overview = is_docs and page.meta and page.meta.page_type == "docs-overview" %} {% set is_records = "/rfcs/" in canonical or "/meetings/" in canonical %} {% set is_record_index = page.title in ["PowerContext RFCs", "PowerContext RFC", "Meeting notes", "会议纪要"] %} {% set previous_url = (page.previous_page.url | string) if page.previous_page else "" %} {% set next_url = (page.next_page.url | string) if page.next_page else "" %} {% set language_path = "/zh/" if is_zh else "/en/" %} {% set previous_same_language = language_path in "/" ~ previous_url %} {% set next_same_language = language_path in "/" ~ next_url %} {% set previous_is_docs = "/docs/" in "/" ~ previous_url or "/development/" in "/" ~ previous_url or "/modules/" in "/" ~ previous_url %} {% set next_is_docs = "/docs/" in "/" ~ next_url or "/development/" in "/" ~ next_url or "/modules/" in "/" ~ next_url %} {% set previous_is_records = "/rfcs/" in "/" ~ previous_url or "/meetings/" in "/" ~ previous_url %} {% set next_is_records = "/rfcs/" in "/" ~ next_url or "/meetings/" in "/" ~ next_url %} {% set show_previous = not is_docs_overview and not is_record_index and page.previous_page and previous_same_language and ((is_docs and previous_is_docs) or (is_records and previous_is_records) or (not is_docs and not is_records)) %} {% set show_next = not is_docs_overview and not is_record_index and page.next_page and next_same_language and ((is_docs and next_is_docs) or (is_records and next_is_records) or (not is_docs and not is_records)) %}