Skip to content

Commit

Permalink
feat(hexo): support content slot
Browse files Browse the repository at this point in the history
  • Loading branch information
ourai committed Apr 7, 2023
1 parent f6b39bd commit a57263b
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function copyAssets(distRoot, polyfill) {
});

const distStyleDirPath = `${distRoot}/stylesheets/ksio/`;

const shareSnsStyleFilePath = `${distStyleDirPath}/vendors/share.scss`;
const shareSnsStyleFileContent = readData(shareSnsStyleFilePath);

Expand Down
6 changes: 3 additions & 3 deletions src/hexo/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ ksio:
type: posts
values:
ksio_asset_css:
- stylesheets/ksio/pages/post
- stylesheets/pages/post
ksio_asset_js:
- javascripts/ksio/vendors/jquery.timeago
- javascripts/ksio/vendors/jquery.timeago.zh-CN
Expand All @@ -177,8 +177,8 @@ ksio:
values:
layout: ksio/doc
ksio_asset_css:
- stylesheets/ksio/pages/post
- stylesheets/ksio/pages/doc
- stylesheets/pages/post
- stylesheets/pages/doc
ksio_asset_js:
- javascripts/ksio/vendors/jquery.timeago
- javascripts/ksio/vendors/jquery.timeago.zh-CN
Expand Down
7 changes: 6 additions & 1 deletion src/hexo/themes/lime/layout/_ksio/layouts/default.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
<%- js('javascripts/ksio/vendors/jquery-1.11.3.min') %>
<%- js('javascripts/ksio/vendors/bootstrap.min') %>
</head>
<body class="Page" itemscope itemtype="http:https://schema.org/WebPage">
<% const bodyClass = ['Page'] %>
<% if (page.ksio_slot_banner || page.banner) { %>
<% bodyClass.push('has-headerImage') %>
<% } %>
<body class="<%= bodyClass.join(' ') %>" itemscope itemtype="http:https://schema.org/WebPage">
<%- body %>
<script>$('.Article-content > table').addClass('table table-bordered')</script>
<% [].concat(page.ksio_asset_js || []).forEach(jsPath => { %><%- js(jsPath) %><% }) %>
</body>
</html>
3 changes: 1 addition & 2 deletions src/hexo/themes/lime/layout/_ksio/layouts/doc.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
<header class="Article-header">
<%- partial('_ksio/slots/header') %>
</header>
<div class="Article-content col-md-9"><%- page.content %></div>
<div class="Article-content col-md-9"><%- partial('_ksio/slots/content') %></div>
<footer class="Article-footer col-md-3"><%- partial('_ksio/slots/footer') %></footer>
</article>
<%- partial(theme.footer && theme.footer.partial || '_ksio/partials/footer') %>
</main>
</div>
<script>$('table').addClass('table table-bordered')</script>
2 changes: 1 addition & 1 deletion src/hexo/themes/lime/layout/_ksio/layouts/page.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<header class="Article-header">
<%- partial('_ksio/slots/header') %>
</header>
<div class="Article-content col-md-9"><%- page.content %></div>
<div class="Article-content col-md-9"><%- partial('_ksio/slots/content') %></div>
<footer class="Article-footer col-md-3"><%- partial('_ksio/slots/footer') %></footer>
<% if (page.siblings === true) { %>
<!-- 相邻文章 -->
Expand Down
1 change: 1 addition & 0 deletions src/hexo/themes/lime/layout/_ksio/slots/content.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%- page.ksio_slot_content ? partial(page.ksio_slot_content) : page.content %>
1 change: 1 addition & 0 deletions src/hexo/themes/lime/source/stylesheets/pages/doc.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "../ksio/pages/doc";
1 change: 1 addition & 0 deletions src/hexo/themes/lime/source/stylesheets/pages/post.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "../ksio/pages/post";
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import "../../helper";
@import "../syntax-highlighting";



Expand Down
File renamed without changes.

0 comments on commit a57263b

Please sign in to comment.