Skip to content

Commit 734ac0c

Browse files
committed
feat(templates): update navigate
1 parent 11c8dea commit 734ac0c

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

src/templates/contribute.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<h3><%= i18n.contribute?.cta?.title %></h3>
1616
<p><%= i18n.contribute?.cta?.description %></p>
1717
<a href="https://github.com/jzero-io/templates/fork" target="_blank" rel="noopener" class="btn btn-primary">
18-
<%= i18n.contribution?.button %>
18+
<%= i18n.contribute?.cta?.button %>
1919
</a>
2020
</div>
2121
</div>

src/templates/layout.ejs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,24 @@
6363
<div class="lang-dropdown" id="langDropdown">
6464
<% supportedLangs.forEach(l => { %>
6565
<% const langName = l === 'zh' ? '中文' : l === 'en' ? 'English' : l.toUpperCase(); %>
66-
<% const href = l === defaultLang ? '/' : '/' + l + '/'; %>
67-
<% if (currentPage === 'detail' && typeof templateId !== 'undefined' && typeof templateType !== 'undefined') { %>
68-
<a
69-
href="<%= href %><%= templateType %>/<%= templateId %>/"
70-
class="lang-option <%= l === currentLang ? 'active' : '' %>"
71-
>
72-
<%= langName %>
73-
</a>
66+
<% let href = ''; %>
67+
<% if (l === defaultLang) { %>
68+
<% href = '/' + (currentPage === 'home' ? '' : currentPage + '/'); %>
69+
<% if (currentPage === 'detail' && typeof templateId !== 'undefined' && typeof templateType !== 'undefined') { %>
70+
<% href = '/' + templateType + '/' + templateId + '/'; %>
71+
<% } %>
7472
<% } else { %>
75-
<a
76-
href="<%= href %>"
77-
class="lang-option <%= l === currentLang ? 'active' : '' %>"
78-
>
79-
<%= langName %>
80-
</a>
73+
<% href = '/' + l + '/' + (currentPage === 'home' ? '' : currentPage + '/'); %>
74+
<% if (currentPage === 'detail' && typeof templateId !== 'undefined' && typeof templateType !== 'undefined') { %>
75+
<% href = '/' + l + '/' + templateType + '/' + templateId + '/'; %>
76+
<% } %>
8177
<% } %>
78+
<a
79+
href="<%= href %>"
80+
class="lang-option <%= l === currentLang ? 'active' : '' %>"
81+
>
82+
<%= langName %>
83+
</a>
8284
<% }) %>
8385
</div>
8486
</div>

0 commit comments

Comments
 (0)