Skip to content

Commit dfccbfc

Browse files
committed
doc: fix edit page link & cleanup
1 parent 97d5f65 commit dfccbfc

1 file changed

Lines changed: 6 additions & 53 deletions

File tree

www/_layouts/docs.html

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -55,64 +55,17 @@
5555
{% endcomment %}
5656
{% if page.edit_link %}
5757
<a class="edit hidden-xs hidden-sm" href="{{ page.edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_text }}</a>
58-
59-
{% comment %}
60-
Otherwise, show editing and translating options.
61-
62-
Edit-links obey the following rules:
63-
64-
if page in /dev/ or /latest/:
65-
show edit link for /dev/ page in source language
66-
if page not in source language:
67-
show translation link for /dev/ page
68-
else:
69-
show edit link for the page in its version and language
70-
71-
{% endcomment %}
7258
{% else %}
73-
7459
{% capture base_edit_link %}https://github.com/apache/cordova-docs/tree/master/www/{{ page.path }}{% endcapture %}
7560
{% capture base_version %}/{{ page.version }}/{% endcapture %}
76-
{% capture base_language %}/{{ page.language }}/{% endcapture %}
77-
{% capture dev_version %}/dev/{% endcapture %}
78-
{% capture src_language %}/{{ site.src_language }}/{% endcapture %}
79-
80-
{% comment %}
81-
Edit-links for current pages in non-source languages
82-
NOTE:
83-
Pages that are under /dev/ or /latest/ (i.e. site.latest_docs_version) have page.current set to "true".
84-
{% endcomment %}
85-
{% if page.language != site.src_language and page.current %}
86-
87-
{% comment %}
88-
Compute crowdin link
89-
{% endcomment %}
90-
{% capture page_path_prefix %}docs/{{ page.language }}/{{ page.version }}{% endcapture %}
91-
{% assign page_path_end = page.path | split:"/" | last %}
92-
{% assign crowdin_path = page.path | replace:page_path_prefix,"docs/en/dev" | replace:page_path_end,"" %}
93-
{% capture crowdin_link %}https://crowdin.com/project/cordova/{{ page.language }}#/cordova-docs/{{ crowdin_path }}{% endcapture %}
94-
95-
{% assign edit_link = base_edit_link | replace:base_language,src_language | replace:base_version,dev_version %}
96-
97-
<a class="edit" href="{{ edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_source_text }}</a>
98-
<a class="edit" href="{{ crowdin_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_translation_text }}</a>
99-
100-
{% comment %}
101-
Edit-links for all other pages
102-
{% endcomment %}
61+
{% capture latest_version %}/latest/{% endcapture %}
62+
{% if page.version == site.latest_docs_version %}
63+
{% assign edit_link = base_edit_link | replace:base_version,latest_version %}
10364
{% else %}
104-
105-
{% comment %}
106-
Edit-link for latest version points to dev instead
107-
{% endcomment %}
108-
{% if page.version == site.latest_docs_version %}
109-
{% assign edit_link = base_edit_link | replace:base_version,dev_version %}
110-
{% else %}
111-
{% assign edit_link = base_edit_link %}
112-
{% endif %}
113-
114-
<a class="edit" href="{{ edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_source_text }}</a>
65+
{% assign edit_link = base_edit_link %}
11566
{% endif %}
67+
68+
<a class="edit" href="{{ edit_link }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> {{ page.edit_source_text }}</a>
11669
{% endif %}
11770
</div>
11871

0 commit comments

Comments
 (0)