Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ORGANIZATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Powered by [Hexo](https://hexo.io/)
- `_data/` -
- `community/index.md` - Community page.
- `faq/index.md` - FAQ page.
- `images/` - Site images
- `images/` - Site images
- `themes/` - Layout, CSS, releases.
- `exokit/`
- `layout/` - HTML and templates.
Expand Down
47 changes: 0 additions & 47 deletions scripts/generators.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,3 @@ hexo.extend.generator.register('examples', function (locals) {

return routes;
});

/**
* Paginated blog.
*/
hexo.extend.generator.register('blog', function (locals) {
var routes = [];
var perPage = hexo.config.per_page;
var posts = locals.posts.sort('date', -1);
for (var i = 1, j = posts.length, page = 1; i < j; i += perPage, page++) {
// blog/page/*/
var route = {
path: 'blog/' + page + '/',
data: {
blog_index: true,
posts: posts.slice(i - 1, i - 1 + perPage),
},
layout: 'blog'
};

// Next.
if (i + perPage < posts.length) {
route.data.next = {
pageNum: page + 1,
path: '/blog/' + (page + 1) + '/',
title: 'Next Page'
};
}

// Prev.
if (i > 1) {
route.data.prev = {
pageNum: page - 1,
path: page - 1 === 1 ? 'blog/' : '/blog/' + (page - 1) + '/',
title: 'Previous Page'
};
}

// blog/ root alias of blog/page/1/.
routes.push(route);
if (page === 1) {
var indexRoute = Object.assign({}, route);
indexRoute.path = 'blog/';
routes.push(indexRoute);
}
}
return routes;
});
72 changes: 1 addition & 71 deletions scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,69 +56,10 @@ hexo.extend.helper.register('table_of_contents', function (content) {
return toc;
});

/**
* twitter|exokitxr -> [@exokitxr](twitter.com/exokitxr)
* twitter|exokitxr|Exokit XR -> [Exokit XR](twitter.com/exokitxr)
* github|exokitxr -> [exokitxr](github.com/exokitxr)
* exokitxr -> [exokitxr](exokitxr)
* http://exokitxr.com|Exokit XR -> [Exokit XR](exokitxr.com)
*/
hexo.extend.helper.register('blog_attribution', function (author) {
var authorSplit = author.split('|');
var display;
var link;

// Nothing to do.
if (authorSplit.length === 1) { return author; }

// Twitter handle.
if (authorSplit[0] === 'twitter') {
if (authorSplit.length === 2) {
display = authorSplit[1];
link = authorSplit[1];
} else {
display = authorSplit[2];
link = authorSplit[1];
}
// Strip `@` from link.
if (link[0] === '@') {
link = link.substring(1);
}
return '<a class="blog-attribution" href="https://twitter.com/' + link + '">' +
display + '</a>';
}

// GitHub username.
if (authorSplit[0] === 'github') {
if (authorSplit.length === 2) {
display = authorSplit[1];
link = authorSplit[1];
} else {
display = authorSplit[2];
link = authorSplit[1];
}
return '<a class="blog-attribution" href="https://github.com/' + link + '">' +
display + '</a>';
}

// Link.
display = authorSplit[1];
link = authorSplit[0];
return '<a class="blog-attribution" href="' + link + '">' + display + '</a>';
});

hexo.extend.helper.register('markdown', function (text) {
return hexo.render.renderSync({text: text, engine: 'markdown'});
});

hexo.extend.helper.register('blog_date', function (date) {
return moment(date).format('MMM D[,] YYYY');
});

hexo.extend.helper.register('blog_date_subtract_week', function (date) {
return moment(date).subtract({weeks: 1}).format('MMM D[,] YYYY');
});

/**
* #1000 -> github.com/exokitxr/exokit/pull/1000
* abcde -> github.com/exokitxr/exokit/commit/abcde
Expand Down Expand Up @@ -164,9 +105,7 @@ hexo.extend.helper.register('website_github_edit_url', function (path) {
return urljoin(this.config.github.exokit_site.url, 'edit', MASTER,
path.replace('docs/', 'src/docs/').replace(/\.html$/, '.md'));
}
// For blog posts.
return urljoin(this.config.github.exokit_site.url, 'edit', MASTER, this.config.source_dir,
path.replace(/\.html$/, '.md'));

});

/**
Expand Down Expand Up @@ -248,10 +187,6 @@ hexo.extend.helper.register('is_external_url', isUrl);
* Generate description for `<meta name="description">`.
*/
hexo.extend.helper.register('meta_description', function (page) {
// If blog or documentation, return article excerpt.
if (page.layout === 'docs' || (page.layout === 'blog' && !page.blog_index)) {
return striptags(page.excerpt).substring(0, 280);
}
// Else, return vanilla description.
return hexo.config.description;
});
Expand All @@ -260,11 +195,6 @@ hexo.extend.helper.register('meta_description', function (page) {
* Infer image for `<meta property="og:image">` and Twitter card.
*/
hexo.extend.helper.register('meta_image', function (page, defaultCard) {
// If blog, return blog image.
if (page.layout === 'blog' && !page.blog_index && page.image &&
!page.image.src.endsWith('.gif')) {
return 'images/blog/' + page.image.src;
}
// Else, return default card image.
return defaultCard;
});
10 changes: 10 additions & 0 deletions src/_posts/helloworld.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: "Hello World"
date: 2018-1-1
layout: blog
image:
src: https://raw.githubusercontent.com/exokitxr/exokit/master/icon.png
author: https://twitter.com/exokitxr|Exokit
---

## Hello World
1 change: 0 additions & 1 deletion themes/exokit/layout/partials/secondary/sidebar_header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
var links = [
{url: 'docs/introduction/', text: 'Docs'},
{url: 'community/', text: 'Community'},
{url: 'showcase/', text: 'Showcase'},
{url: config.github.exokitxr.url, text: 'GitHub', slug: 'github', title: 'Exokit Project Repository'},
{url: config.discord.exokit.url, text: 'Discord'}
];
Expand Down
1 change: 0 additions & 1 deletion themes/exokit/source/css/_common.styl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ h4
.copy__wrap
padding 40px


.nav, .subnav
list-style-type none

Expand Down
1 change: 1 addition & 0 deletions themes/exokit/source/css/secondary.styl
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ video
.docs-header + blockquote
margin 4em 0 2em


[data-is-mobile="true"] #docs-version
border 1px solid #CCC

Expand Down