@@ -56,69 +56,10 @@ hexo.extend.helper.register('table_of_contents', function (content) {
56
56
return toc ;
57
57
} ) ;
58
58
59
- /**
60
- * twitter|exokitxr -> [@exokitxr](twitter.com/exokitxr)
61
- * twitter|exokitxr|Exokit XR -> [Exokit XR](twitter.com/exokitxr)
62
- * github|exokitxr -> [exokitxr](github.com/exokitxr)
63
- * exokitxr -> [exokitxr](exokitxr)
64
- * http://exokitxr.com|Exokit XR -> [Exokit XR](exokitxr.com)
65
- */
66
- hexo . extend . helper . register ( 'blog_attribution' , function ( author ) {
67
- var authorSplit = author . split ( '|' ) ;
68
- var display ;
69
- var link ;
70
-
71
- // Nothing to do.
72
- if ( authorSplit . length === 1 ) { return author ; }
73
-
74
- // Twitter handle.
75
- if ( authorSplit [ 0 ] === 'twitter' ) {
76
- if ( authorSplit . length === 2 ) {
77
- display = authorSplit [ 1 ] ;
78
- link = authorSplit [ 1 ] ;
79
- } else {
80
- display = authorSplit [ 2 ] ;
81
- link = authorSplit [ 1 ] ;
82
- }
83
- // Strip `@` from link.
84
- if ( link [ 0 ] === '@' ) {
85
- link = link . substring ( 1 ) ;
86
- }
87
- return '<a class="blog-attribution" href="https://twitter.com/' + link + '">' +
88
- display + '</a>' ;
89
- }
90
-
91
- // GitHub username.
92
- if ( authorSplit [ 0 ] === 'github' ) {
93
- if ( authorSplit . length === 2 ) {
94
- display = authorSplit [ 1 ] ;
95
- link = authorSplit [ 1 ] ;
96
- } else {
97
- display = authorSplit [ 2 ] ;
98
- link = authorSplit [ 1 ] ;
99
- }
100
- return '<a class="blog-attribution" href="https://github.com/' + link + '">' +
101
- display + '</a>' ;
102
- }
103
-
104
- // Link.
105
- display = authorSplit [ 1 ] ;
106
- link = authorSplit [ 0 ] ;
107
- return '<a class="blog-attribution" href="' + link + '">' + display + '</a>' ;
108
- } ) ;
109
-
110
59
hexo . extend . helper . register ( 'markdown' , function ( text ) {
111
60
return hexo . render . renderSync ( { text : text , engine : 'markdown' } ) ;
112
61
} ) ;
113
62
114
- hexo . extend . helper . register ( 'blog_date' , function ( date ) {
115
- return moment ( date ) . format ( 'MMM D[,] YYYY' ) ;
116
- } ) ;
117
-
118
- hexo . extend . helper . register ( 'blog_date_subtract_week' , function ( date ) {
119
- return moment ( date ) . subtract ( { weeks : 1 } ) . format ( 'MMM D[,] YYYY' ) ;
120
- } ) ;
121
-
122
63
/**
123
64
* #1000 -> github.com/exokitxr/exokit/pull/1000
124
65
* abcde -> github.com/exokitxr/exokit/commit/abcde
@@ -164,9 +105,7 @@ hexo.extend.helper.register('website_github_edit_url', function (path) {
164
105
return urljoin ( this . config . github . exokit_site . url , 'edit' , MASTER ,
165
106
path . replace ( 'docs/' , 'src/docs/' ) . replace ( / \. h t m l $ / , '.md' ) ) ;
166
107
}
167
- // For blog posts.
168
- return urljoin ( this . config . github . exokit_site . url , 'edit' , MASTER , this . config . source_dir ,
169
- path . replace ( / \. h t m l $ / , '.md' ) ) ;
108
+
170
109
} ) ;
171
110
172
111
/**
@@ -248,10 +187,6 @@ hexo.extend.helper.register('is_external_url', isUrl);
248
187
* Generate description for `<meta name="description">`.
249
188
*/
250
189
hexo . extend . helper . register ( 'meta_description' , function ( page ) {
251
- // If blog or documentation, return article excerpt.
252
- if ( page . layout === 'docs' || ( page . layout === 'blog' && ! page . blog_index ) ) {
253
- return striptags ( page . excerpt ) . substring ( 0 , 280 ) ;
254
- }
255
190
// Else, return vanilla description.
256
191
return hexo . config . description ;
257
192
} ) ;
@@ -260,11 +195,6 @@ hexo.extend.helper.register('meta_description', function (page) {
260
195
* Infer image for `<meta property="og:image">` and Twitter card.
261
196
*/
262
197
hexo . extend . helper . register ( 'meta_image' , function ( page , defaultCard ) {
263
- // If blog, return blog image.
264
- if ( page . layout === 'blog' && ! page . blog_index && page . image &&
265
- ! page . image . src . endsWith ( '.gif' ) ) {
266
- return 'images/blog/' + page . image . src ;
267
- }
268
198
// Else, return default card image.
269
199
return defaultCard ;
270
200
} ) ;
0 commit comments