Skip to content

Commit 1f9ef9c

Browse files
authored
Added Hexo and NexT environment variables. (#240)
* Added Hexo and NexT environment variables. 1. Replaced Hexo version by full `env` variable. Here is values: https://github.com/hexojs/hexo/blob/373b9c745cb5dfe25e942e720aca2cdac78e1874/lib/hexo/index.js#L47-L55 2. From this moment version of NexT will be readed from `package.json` file. So, no need to set version in NexT `_config.yml` file anymore. Also, all other values from `package.json` can be readed with `next_env('value')` function in template. 3. Edited `package.json` and `bower.json` (correct author values, some tags). * Added `require` and `hexo` to excludes.
1 parent ac0ab13 commit 1f9ef9c

File tree

16 files changed

+39
-36
lines changed

16 files changed

+39
-36
lines changed

.jshintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
"$",
1717
"jQuery",
1818
"NexT",
19-
"CONFIG"
19+
"CONFIG",
20+
"require",
21+
"hexo"
2022
],
2123
"quotmark": true,
2224
"trailing": true,

_config.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,3 @@ vendors:
960960
css: css
961961
js: js
962962
images: images
963-
964-
# Theme version
965-
version: 6.2.0
966-

bower.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
"version": "6.2.0",
44
"homepage": "https://theme-next.org",
55
"authors": [
6-
"iissnan <iissnan@gmail.com>",
7-
"Ivan Nginx <ivan.nginx@gmail.com> (https://almostover.ru)"
6+
"NexT <support@theme-next.org> (https://theme-next.org)"
87
],
98
"description": "Elegant theme for Hexo",
109
"repository": "https://github.com/theme-next/hexo-theme-next",
1110
"keywords": [
1211
"hexo",
1312
"theme",
14-
"NexT"
13+
"next"
1514
],
1615
"license": "AGPL",
1716
"ignore": [

layout/_layout.swig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<!DOCTYPE html>
22

3+
{# NexT version #}
4+
{% set version = next_env('version') %}
5+
36
{% set html_class = 'theme-next ' + theme.scheme %}
47
{% if theme.motion.enable %}
58
{% set html_class = html_class + ' use-motion' %}

layout/_partials/footer.swig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
{% if theme.footer.powered.enable %}
4242
<div class="powered-by">{#
43-
#}{{ __('footer.powered', '<a class="theme-link" target="_blank"' + nofollow + ' href="https://hexo.io">Hexo</a>') }}{% if theme.footer.powered.version %} v{{ hexo_version() }}{% endif %}{#
43+
#}{{ __('footer.powered', '<a class="theme-link" target="_blank"' + nofollow + ' href="https://hexo.io">Hexo</a>') }}{% if theme.footer.powered.version %} v{{ hexo_env('version') }}{% endif %}{#
4444
#}</div>
4545
{% endif %}
4646

@@ -53,7 +53,7 @@
5353
#}{{ __('footer.theme') }} &mdash; {#
5454
#}<a class="theme-link" target="_blank"{{ nofollow }} href="https://github.com/theme-next/hexo-theme-next">{#
5555
#}NexT.{{ theme.scheme }}{#
56-
#}</a>{% if theme.footer.theme.version %} v{{ theme.version }}{% endif %}{#
56+
#}</a>{% if theme.footer.theme.version %} v{{ version }}{% endif %}{#
5757
#}</div>
5858
{% endif %}
5959

layout/_partials/head/head.swig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@
8080
{% endif %}
8181
<link href="{{ font_awesome_uri }}" rel="stylesheet" type="text/css" />
8282

83-
<link href="{{ url_for(theme.css) }}/main.css?v={{ theme.version }}" rel="stylesheet" type="text/css" />
83+
<link href="{{ url_for(theme.css) }}/main.css?v={{ version }}" rel="stylesheet" type="text/css" />
8484

8585
{% if theme.favicon.apple_touch_icon %}
86-
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for(theme.favicon.apple_touch_icon) }}?v={{ theme.version }}">
86+
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for(theme.favicon.apple_touch_icon) }}?v={{ version }}">
8787
{% endif %}
8888
{% if theme.favicon.medium %}
89-
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for(theme.favicon.medium) }}?v={{ theme.version }}">
89+
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for(theme.favicon.medium) }}?v={{ version }}">
9090
{% endif %}
9191
{% if theme.favicon.small %}
92-
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for(theme.favicon.small) }}?v={{ theme.version }}">
92+
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for(theme.favicon.small) }}?v={{ version }}">
9393
{% endif %}
9494
{% if theme.favicon.safari_pinned_tab %}
95-
<link rel="mask-icon" href="{{ url_for(theme.favicon.safari_pinned_tab) }}?v={{ theme.version }}" color="{{ theme.android_chrome_color }}">
95+
<link rel="mask-icon" href="{{ url_for(theme.favicon.safari_pinned_tab) }}?v={{ version }}" color="{{ theme.android_chrome_color }}">
9696
{% endif %}
9797
{% if theme.favicon.android_manifest %}
9898
<link rel="manifest" href="{{ url_for(theme.favicon.android_manifest) }}">
@@ -114,7 +114,7 @@
114114
var CONFIG = {
115115
root: '{{ theme.root }}',
116116
scheme: '{{ theme.scheme }}',
117-
version: '{{ theme.version }}',
117+
version: '{{ version }}',
118118
sidebar: {{ theme.sidebar | json_encode }},
119119
fancybox: {{ theme.fancybox }},
120120
fastclick: {{ theme.fastclick }},

layout/_scripts/boostrap.swig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
%}
66

77
{% for bs in boot_scripts %}
8-
<script type="text/javascript" src="{{ url_for(theme.js) }}/{{ bs }}?v={{ theme.version }}"></script>
8+
<script type="text/javascript" src="{{ url_for(theme.js) }}/{{ bs }}?v={{ version }}"></script>
99
{% endfor %}

layout/_scripts/commons.swig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
%}
77

88
{% for common in js_commons %}
9-
<script type="text/javascript" src="{{ url_for(theme.js) }}/{{ common }}?v={{ theme.version }}"></script>
9+
<script type="text/javascript" src="{{ url_for(theme.js) }}/{{ common }}?v={{ version }}"></script>
1010
{% endfor %}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<script type="text/javascript" src="{{ url_for(theme.js) }}/src/scrollspy.js?v={{ theme.version }}"></script>
2-
<script type="text/javascript" src="{{ url_for(theme.js) }}/src/post-details.js?v={{ theme.version }}"></script>
1+
<script type="text/javascript" src="{{ url_for(theme.js) }}/src/scrollspy.js?v={{ version }}"></script>
2+
<script type="text/javascript" src="{{ url_for(theme.js) }}/src/post-details.js?v={{ version }}"></script>

layout/_scripts/schemes/gemini.swig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
%}
77

88
{% for script in scripts %}
9-
<script type="text/javascript" src="{{ url_for(theme.js) }}/{{ script }}?v={{ theme.version }}"></script>
9+
<script type="text/javascript" src="{{ url_for(theme.js) }}/{{ script }}?v={{ version }}"></script>
1010
{% endfor %}

0 commit comments

Comments
 (0)