From f984ea0dc23b0fd117bb4cf1cb607e7f573b1c91 Mon Sep 17 00:00:00 2001 From: timhartmann Date: Tue, 25 Jun 2019 13:30:53 +0200 Subject: [PATCH] refactor(*): use ejs templates, change tags --- _config.yml | 68 +++++--------- package.json | 1 + scripts/helpers.js | 10 +++ source/de/about-us/index.md | 3 - source/de/index.md | 2 - themes/keycard/languages/de.yml | 19 ++-- themes/keycard/languages/en.yml | 19 ++-- themes/keycard/layout/{404.swig => 404.ejs} | 0 .../layout/{about-us.swig => about-us.ejs} | 90 +++++++++---------- .../keycard/layout/{index.swig => index.ejs} | 52 +++++------ themes/keycard/layout/layout.ejs | 11 +++ themes/keycard/layout/layout.swig | 11 --- .../partial/{footer.swig => footer.ejs} | 32 +++---- themes/keycard/layout/partial/head.ejs | 30 +++++++ themes/keycard/layout/partial/head.swig | 30 ------- themes/keycard/layout/partial/header.ejs | 62 +++++++++++++ themes/keycard/layout/partial/header.swig | 46 ---------- .../partial/{mailpopup.swig => mailpopup.ejs} | 0 yarn.lock | 9 +- 19 files changed, 253 insertions(+), 242 deletions(-) create mode 100644 scripts/helpers.js delete mode 100644 source/de/about-us/index.md delete mode 100644 source/de/index.md rename themes/keycard/layout/{404.swig => 404.ejs} (100%) rename themes/keycard/layout/{about-us.swig => about-us.ejs} (50%) rename themes/keycard/layout/{index.swig => index.ejs} (93%) create mode 100644 themes/keycard/layout/layout.ejs delete mode 100644 themes/keycard/layout/layout.swig rename themes/keycard/layout/partial/{footer.swig => footer.ejs} (95%) create mode 100644 themes/keycard/layout/partial/head.ejs delete mode 100644 themes/keycard/layout/partial/head.swig create mode 100644 themes/keycard/layout/partial/header.ejs delete mode 100644 themes/keycard/layout/partial/header.swig rename themes/keycard/layout/partial/{mailpopup.swig => mailpopup.ejs} (100%) diff --git a/_config.yml b/_config.yml index 47734e4..63a2f1e 100644 --- a/_config.yml +++ b/_config.yml @@ -6,17 +6,27 @@ title: Keycard description: Keycard is a new type of smartcard built with an open API for simple integration with crypto wallets and hardware. Designed to safely send, store, and receive cryptocurrencies in a seamless contactless experience. author: Status Research & Development GmbH -language: - - en - - de +language: [en] +locale: en +i18n: + type: [page, post] +permalink_defaults: + lang: en i18n_dir: :lang -menu: - Why: '#why' - Features: '#features' - Security: '#security' - Keycard API: '#keycard-api' - About us: /de/about-us + +header: + menu: + why: + title: Why + features: + title: Features + security: + title: Security + keycard: + title: Keycard API + about: + title: About us menubutton: Get Keycard @@ -25,55 +35,17 @@ menubutton: Get Keycard url: https://keycard.status.im/ root: / permalink: :year/:month/:day/:title/ - -# Writing -new_post_name: :title.md # File name of new posts -default_layout: post -render_drafts: false post_asset_folder: true -future: true -highlight: - enable: true - line_number: true - auto_detect: false - tab_replace: - -# Home page setting -# path: Root path for your blogs index page. (default = '') -# per_page: Posts displayed per page. (0 = disable pagination) -# order_by: Posts order. (Order by date descending by default) -index_generator: - path: '' - per_page: 10 - order_by: -date - -# Category & Tag -default_category: uncategorized -category_map: -tag_map: - -# Date / Time format -## Hexo uses Moment.js to parse and display date -## You can customize the date format as defined in -## http://momentjs.com/docs/#/displaying/format/ -date_format: YYYY-MM-DD -time_format: HH:mm:ss # Pagination ## Set per_page to 0 to disable pagination -per_page: 10 -pagination_dir: page +per_page: 0 # Extensions ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: keycard -# Deployment -## Docs: https://hexo.io/docs/deployment.html -deploy: - type: - autoprefixer: enable: true browsers: diff --git a/package.json b/package.json index a081510..30cc883 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "hexo-autoprefixer": "^2.0.0", "hexo-generator-archive": "^0.1.5", "hexo-generator-category": "^0.1.3", + "hexo-generator-i18n": "^0.0.7", "hexo-generator-index": "^0.2.1", "hexo-generator-tag": "^0.2.0", "hexo-renderer-ejs": "^0.3.1", diff --git a/scripts/helpers.js b/scripts/helpers.js new file mode 100644 index 0000000..e9f4eee --- /dev/null +++ b/scripts/helpers.js @@ -0,0 +1,10 @@ +hexo.extend.helper.register('show_lang', function (lang) { + if (this.page.lang != 'en') { + return '/' + this.page.lang; + } +}); + +hexo.extend.helper.register('lang_name', function(lang) { + var data = this.site.data.languages[lang]; + return data.name || data; +}); \ No newline at end of file diff --git a/source/de/about-us/index.md b/source/de/about-us/index.md deleted file mode 100644 index 15f548c..0000000 --- a/source/de/about-us/index.md +++ /dev/null @@ -1,3 +0,0 @@ -title: About us -layout: about-us ---- diff --git a/source/de/index.md b/source/de/index.md deleted file mode 100644 index b455682..0000000 --- a/source/de/index.md +++ /dev/null @@ -1,2 +0,0 @@ -title: Homepage ---- diff --git a/themes/keycard/languages/de.yml b/themes/keycard/languages/de.yml index 3138768..7e8db15 100644 --- a/themes/keycard/languages/de.yml +++ b/themes/keycard/languages/de.yml @@ -1,11 +1,16 @@ -menu: - Warum: '#why' - Features: '#features' - Security: '#security' - Keycard API: '#keycard-api' - About us: /de/about-us - header: + menu: + why: + title: Warum + features: + title: Features + security: + title: Sicherheit + keycard: + title: Keycard API + about: + title: Über uns + title: Sicher, Kontaktlos, Open Source Geldbörse button: primary: Keycard erhalten diff --git a/themes/keycard/languages/en.yml b/themes/keycard/languages/en.yml index 295114d..fc0f7f0 100644 --- a/themes/keycard/languages/en.yml +++ b/themes/keycard/languages/en.yml @@ -1,13 +1,18 @@ -menu: - Why: '#why' - Features: '#features' - Security: '#security' - Keycard API: '#keycard-api' - About us: /about-us - menubutton: Get Keycard header: + menu: + why: + title: Why + features: + title: Features + security: + title: Security + keycard: + title: Keycard API + about: + title: About us + title: Secure, Contactless, Open Source Hardwallet subtitle: Keycard is a new type of smartcard built with an open API for simple integration with crypto wallets and hardware. Designed to safely send, store, and receive cryptocurrencies in a seamless contactless experience. button: diff --git a/themes/keycard/layout/404.swig b/themes/keycard/layout/404.ejs similarity index 100% rename from themes/keycard/layout/404.swig rename to themes/keycard/layout/404.ejs diff --git a/themes/keycard/layout/about-us.swig b/themes/keycard/layout/about-us.ejs similarity index 50% rename from themes/keycard/layout/about-us.swig rename to themes/keycard/layout/about-us.ejs index 6ecc8b8..cba7a40 100644 --- a/themes/keycard/layout/about-us.swig +++ b/themes/keycard/layout/about-us.ejs @@ -3,11 +3,11 @@
- +
-

{{__('about.block.opensource.title')}}

-

{{__('about.block.opensource.subtitle')}}

+

<%- __('about.block.opensource.title') %>

+

<%- __('about.block.opensource.subtitle') %>

@@ -15,126 +15,126 @@
-

{{__('about.block.contributions.title')}}

-

{{__('about.block.contributions.subtitle')}}

+

<%- __('about.block.contributions.title') %>

+

<%- __('about.block.contributions.subtitle') %>

- -

{{__('about.block.contributions.people.a.title')}}

-

{{__('about.block.contributions.people.a.job')}}

+ +

<%- __('about.block.contributions.people.a.title') %>

+

<%- __('about.block.contributions.people.a.job') %>

- -

{{__('about.block.contributions.people.b.title')}}

-

{{__('about.block.contributions.people.b.job')}}

+ +

<%- __('about.block.contributions.people.b.title') %>

+

<%- __('about.block.contributions.people.b.job') %>

- -

{{__('about.block.contributions.people.c.title')}}

-

{{__('about.block.contributions.people.c.job')}}

+ +

<%- __('about.block.contributions.people.c.title') %>

+

<%- __('about.block.contributions.people.c.job') %>

- -

{{__('about.block.contributions.people.d.title')}}

-

{{__('about.block.contributions.people.d.job')}}

+ +

<%- __('about.block.contributions.people.d.title') %>

+

<%- __('about.block.contributions.people.d.job') %>

- -

{{__('about.block.contributions.people.e.title')}}

-

{{__('about.block.contributions.people.e.job')}}

+ +

<%- __('about.block.contributions.people.e.title') %>

+

<%- __('about.block.contributions.people.e.job') %>

- -

{{__('about.block.contributions.people.f.title')}}

-

{{__('about.block.contributions.people.f.job')}}

+ +

<%- __('about.block.contributions.people.f.title') %>

+

<%- __('about.block.contributions.people.f.job') %>

- -

{{__('about.block.contributions.people.g.title')}}

-

{{__('about.block.contributions.people.g.job')}}

+ +

<%- __('about.block.contributions.people.g.title') %>

+

<%- __('about.block.contributions.people.g.job') %>

- -

{{__('about.block.contributions.people.h.title')}}

-

{{__('about.block.contributions.people.h.job')}}

+ +

<%- __('about.block.contributions.people.h.title') %>

+

<%- __('about.block.contributions.people.h.job') %>

diff --git a/themes/keycard/layout/index.swig b/themes/keycard/layout/index.ejs similarity index 93% rename from themes/keycard/layout/index.swig rename to themes/keycard/layout/index.ejs index db0987d..0276143 100644 --- a/themes/keycard/layout/index.swig +++ b/themes/keycard/layout/index.ejs @@ -6,12 +6,12 @@

- {{ __('home.block.ecosystem.title') }} + <%- __('home.block.ecosystem.title') %>

-

{{ __('home.block.ecosystem.subtitle') }}

+

<%- __('home.block.ecosystem.subtitle') %>

- +
@@ -21,7 +21,7 @@

- {{ __('home.block.doing.title') }} + <%- __('home.block.doing.title') %>

@@ -49,8 +49,8 @@
-

{{ __('home.block.doing.itemA.title') }}

-

{{ __('home.block.doing.itemA.subtitle') }}

+

<%- __('home.block.doing.itemA.title') %>

+

<%- __('home.block.doing.itemA.subtitle') %>

@@ -67,8 +67,8 @@
-

{{ __('home.block.doing.itemB.title') }}

-

{{ __('home.block.doing.itemB.subtitle') }}

+

<%- __('home.block.doing.itemB.title') %>

+

<%- __('home.block.doing.itemB.subtitle') %>

@@ -83,8 +83,8 @@
-

{{ __('home.block.doing.itemC.title') }}

-

{{ __('home.block.doing.itemC.subtitle') }}

+

<%- __('home.block.doing.itemC.title') %>

+

<%- __('home.block.doing.itemC.subtitle') %>

@@ -99,8 +99,8 @@
-

{{ __('home.block.doing.itemD.title') }}

-

{{ __('home.block.doing.itemD.subtitle') }}

+

<%- __('home.block.doing.itemD.title') %>

+

<%- __('home.block.doing.itemD.subtitle') %>

@@ -121,8 +121,8 @@
-

{{ __('home.block.doing.itemD.title') }}

-

{{ __('home.block.doing.itemD.subtitle') }}

+

<%- __('home.block.doing.itemD.title') %>

+

<%- __('home.block.doing.itemD.subtitle') %>

@@ -136,14 +136,14 @@
-

{{ __('home.block.security.title') }}

-

{{ __('home.block.security.subtitle') }}

+

<%- __('home.block.security.title') %>

+

<%- __('home.block.security.subtitle') %>

@@ -154,7 +154,7 @@ -

{{ __('home.block.security.itemA.title') }}

+

<%- __('home.block.security.itemA.title') %>

@@ -162,7 +162,7 @@ -

{{ __('home.block.security.itemB.title') }}

+

<%- __('home.block.security.itemB.title') %>

@@ -174,22 +174,22 @@
-

{{ __('home.block.opensource.title') }}

-

{{ __('home.block.opensource.subtitle') }}

-

{{ __('home.block.opensource.text') }}

+

<%- __('home.block.opensource.title') %>

+

<%- __('home.block.opensource.subtitle') %>

+

<%- __('home.block.opensource.text') %>

- +
diff --git a/themes/keycard/layout/layout.ejs b/themes/keycard/layout/layout.ejs new file mode 100644 index 0000000..5bd1855 --- /dev/null +++ b/themes/keycard/layout/layout.ejs @@ -0,0 +1,11 @@ + + + <%- partial('partial/head') %> + + + <%- partial('partial/header') %> + <%- body %> + <%- partial('partial/footer') %> + + + diff --git a/themes/keycard/layout/layout.swig b/themes/keycard/layout/layout.swig deleted file mode 100644 index f7f0e5d..0000000 --- a/themes/keycard/layout/layout.swig +++ /dev/null @@ -1,11 +0,0 @@ - - - {{ partial('partial/head') }} - - - {{ partial('partial/header') }} - {{ body }} - {{ partial('partial/footer') }} - - - diff --git a/themes/keycard/layout/partial/footer.swig b/themes/keycard/layout/partial/footer.ejs similarity index 95% rename from themes/keycard/layout/partial/footer.swig rename to themes/keycard/layout/partial/footer.ejs index 19f22c9..157215e 100644 --- a/themes/keycard/layout/partial/footer.swig +++ b/themes/keycard/layout/partial/footer.ejs @@ -42,34 +42,34 @@
-

{{__('footer.documentation.title')}}

+

<%= __('footer.documentation.title') %>

-

{{__('footer.about.title')}}

+

<%= __('footer.about.title') %>

-

{{__('footer.resources.title')}}

+

<%= __('footer.resources.title') %>

-

{{__('footer.status.title')}}

+

<%= __('footer.status.title') %>

@@ -78,7 +78,7 @@

- {{__('footer.bottomtext')}} + <%= __('footer.bottomtext') %> Status

diff --git a/themes/keycard/layout/partial/head.ejs b/themes/keycard/layout/partial/head.ejs new file mode 100644 index 0000000..64b137f --- /dev/null +++ b/themes/keycard/layout/partial/head.ejs @@ -0,0 +1,30 @@ + + + <% if (page.title) { %><%= __(page.title) %> | <% } %><%= __(config.title) %> + + + + + + + + + + + + + + + + + + + <%- css('css/application') %> + + + + + + + + diff --git a/themes/keycard/layout/partial/head.swig b/themes/keycard/layout/partial/head.swig deleted file mode 100644 index a1822cc..0000000 --- a/themes/keycard/layout/partial/head.swig +++ /dev/null @@ -1,30 +0,0 @@ - - - {% if page.title %}{{ __(page.title) }} | {% endif %}{{ __(config.title) }} - - - - - - - - - - - - - - - - - - - {{ css('css/application.css') }} - - - - - - - - diff --git a/themes/keycard/layout/partial/header.ejs b/themes/keycard/layout/partial/header.ejs new file mode 100644 index 0000000..ab9e5ab --- /dev/null +++ b/themes/keycard/layout/partial/header.ejs @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/themes/keycard/layout/partial/header.swig b/themes/keycard/layout/partial/header.swig deleted file mode 100644 index fcbdec5..0000000 --- a/themes/keycard/layout/partial/header.swig +++ /dev/null @@ -1,46 +0,0 @@ - \ No newline at end of file diff --git a/themes/keycard/layout/partial/mailpopup.swig b/themes/keycard/layout/partial/mailpopup.ejs similarity index 100% rename from themes/keycard/layout/partial/mailpopup.swig rename to themes/keycard/layout/partial/mailpopup.ejs diff --git a/yarn.lock b/yarn.lock index bbc67a7..0f85167 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1190,6 +1190,13 @@ hexo-generator-category@^0.1.3: hexo-pagination "0.0.2" object-assign "^2.0.0" +hexo-generator-i18n@^0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/hexo-generator-i18n/-/hexo-generator-i18n-0.0.7.tgz#ab3c198bd80a0710011afc2e70c13c5b9ee6ec0c" + integrity sha1-qzwZi9gKBxABGvwucME8W57m7Aw= + dependencies: + lodash "^4.15.0" + hexo-generator-index@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/hexo-generator-index/-/hexo-generator-index-0.2.1.tgz#9042229fcac79aaf700575da19332bf3f7ee5c5d" @@ -1750,7 +1757,7 @@ lodash.some@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.some/-/lodash.some-4.6.0.tgz#1bb9f314ef6b8baded13b549169b2a945eb68e4d" integrity sha1-G7nzFO9ri63tE7VJFpsqlF62jk0= -lodash@^4.0.0, lodash@^4.17.11, lodash@^4.2.1, lodash@~4.17.10: +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.17.11, lodash@^4.2.1, lodash@~4.17.10: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==