--- layout: base docs_tab: true analytics_id: UA-64283057-1 --- {% include header.html %} {% comment %} set some constants {% endcomment %} {% assign ALL_PAGES = site.data.all-pages %} {% assign TOCFILE = site.data.toc[page.tocfile] %} {% capture VERSION_ROOT %}/docs/{{ page.language }}/{{ page.version }}/{% endcapture %} {% capture LANGUAGE_ROOT %}/docs/{{ page.language }}/{% endcapture %} {% assign MY_ENTRY = page.url | replace: VERSION_ROOT,"" %} {% assign my_entry_parts = MY_ENTRY | split: "/" %} {% comment %} PATH_TO_ROOT: path from here to version root, replacing all parts except the last one with '../' NOTE: the capture is a single line because extraneous whitespace would screw up the URI it produces {% endcomment %} {% capture PATH_TO_ROOT %}{% for item in my_entry_parts %}{% if forloop.rindex > 1 %}../{% endif %}{% endfor %}{% endcapture %}
{% comment %} Show a single edit-link if the page has a specific edit-link. {% endcomment %} {% if page.edit_link %} {% comment %} Otherwise, show editing and translating options. Edit-links obey the following rules: if page in /dev/ or /latest/: show edit link for /dev/ page in source language if page not in source language: show translation link for /dev/ page else: show edit link for the page in its version and language {% endcomment %} {% else %} {% capture base_edit_link %}https://github.com/apache/cordova-docs/tree/master/www/{{ page.path }}{% endcapture %} {% capture base_version %}/{{ page.version }}/{% endcapture %} {% capture base_language %}/{{ page.language }}/{% endcapture %} {% capture dev_version %}/dev/{% endcapture %} {% capture src_language %}/{{ site.src_language }}/{% endcapture %} {% comment %} Edit-links for current pages in non-source languages NOTE: Pages that are under /dev/ or /latest/ (i.e. site.latest_docs_version) have page.current set to "true". {% endcomment %} {% if page.language != site.src_language and page.current %} {% comment %} Compute crowdin link {% endcomment %} {% capture page_path_prefix %}docs/{{ page.language }}/{{ page.version }}{% endcapture %} {% assign page_path_end = page.path | split:"/" | last %} {% assign crowdin_path = page.path | replace:page_path_prefix,"docs/en/dev" | replace:page_path_end,"" %} {% capture crowdin_link %}https://crowdin.com/project/cordova/{{ page.language }}#/cordova-docs/{{ crowdin_path }}{% endcapture %} {% assign edit_link = base_edit_link | replace:base_language,src_language | replace:base_version,dev_version %} {{ page.edit_source_text }} {{ page.edit_translation_text }} {% comment %} Edit-links for all other pages {% endcomment %} {% else %} {% comment %} Edit-link for latest version points to dev instead {% endcomment %} {% if page.version == site.latest_docs_version %} {% assign edit_link = base_edit_link | replace:base_version,dev_version %} {% else %} {% assign edit_link = base_edit_link %} {% endif %} {{ page.edit_source_text }} {% endif %} {% endif %}
{% comment %} Get URL for this page in the latest version {% endcomment %} {% capture latest_root %}/docs/{{ page.language }}/latest/{% endcapture %} {% assign latest_url = page.url | replace:VERSION_ROOT,latest_root %} {% comment %} If this page doesn't exist, just use root {% endcomment %} {% unless ALL_PAGES contains latest_url %} {% assign latest_url = latest_root %} {% endunless %} {% if page.version == 'dev' %} {% endif %} {% if page.version != 'dev' and page.version != site.latest_docs_version %} {% endif %} {% if page.plugin_name and page.plugin_version %} {% endif %}
{{ content }}
{% include footer_docs.html %}