diff --git a/src/hexo/_config.yml b/src/hexo/_config.yml index 4ab99cb..5cabc58 100644 --- a/src/hexo/_config.yml +++ b/src/hexo/_config.yml @@ -130,6 +130,7 @@ theme_config: navbar: placement: right footer: + partial: _local/footer links: - text: OOSS url: https://oss.ourai.ws/ @@ -151,6 +152,14 @@ ksio: - javascripts/ksio/components/toc post: extends: page + ksio/doc: + values: + ksio_asset_css: + - stylesheets/ksio/vendors/share + ksio_asset_js: + - javascripts/ksio/vendors/share.min + - javascripts/ksio/components/page + - javascripts/ksio/components/toc page: - scope: type: posts @@ -163,6 +172,20 @@ ksio: - javascripts/ksio/initializers/time - javascripts/ksio/vendors/jquery.lazyload - javascripts/ksio/initializers/lazyload + - scope: + type: knosys + values: + layout: ksio/doc + ksio_asset_css: + - stylesheets/ksio/pages/post + - stylesheets/ksio/pages/doc + ksio_asset_js: + - javascripts/ksio/vendors/jquery.timeago + - javascripts/ksio/vendors/jquery.timeago.zh-CN + - javascripts/ksio/initializers/time + - javascripts/ksio/vendors/jquery.lazyload + - javascripts/ksio/initializers/lazyload + repo: cookbook # Deployment ## Docs: https://hexo.io/docs/one-command-deployment diff --git a/src/hexo/source/_data/local/repos.yml b/src/hexo/source/_data/local/repos.yml new file mode 100644 index 0000000..afdfd25 --- /dev/null +++ b/src/hexo/source/_data/local/repos.yml @@ -0,0 +1,14 @@ +cookbook: + name: 食用手册 + collection: guides + toc: + - text: 概述 + collection: pages + slug: guides + - slug: getting-started + - text: API + collection: apis + items: + - site-config + - page-config + - html-reuse diff --git a/src/hexo/themes/lime/layout/_ksio/components/doc-toc.ejs b/src/hexo/themes/lime/layout/_ksio/components/doc-toc.ejs new file mode 100644 index 0000000..558df59 --- /dev/null +++ b/src/hexo/themes/lime/layout/_ksio/components/doc-toc.ejs @@ -0,0 +1,25 @@ + diff --git a/src/hexo/themes/lime/layout/_ksio/layouts/doc.ejs b/src/hexo/themes/lime/layout/_ksio/layouts/doc.ejs new file mode 100644 index 0000000..3cf15ad --- /dev/null +++ b/src/hexo/themes/lime/layout/_ksio/layouts/doc.ejs @@ -0,0 +1,21 @@ +<%- partial(theme.header && theme.header.partial || '_ksio/partials/header') %> +
+ <% const repo = site.data['local/repos'][page.repo] %> + <% if (repo && repo.toc) { %> + + <% } %> +
+
+
+ <%- partial('_ksio/slots/header') %> +
+
<%- page.content %>
+ +
+ <%- partial(theme.footer && theme.footer.partial || '_ksio/partials/footer') %> +
+
+ diff --git a/src/hexo/themes/lime/layout/_ksio/layouts/hack.ejs b/src/hexo/themes/lime/layout/_ksio/layouts/hack.ejs index c59658f..3577715 100644 --- a/src/hexo/themes/lime/layout/_ksio/layouts/hack.ejs +++ b/src/hexo/themes/lime/layout/_ksio/layouts/hack.ejs @@ -1,5 +1,6 @@ -<% if (page.layout && page.layout.split('/')[0] === 'ksio') { %> - <%- partial(`_ksio/layouts/${page.layout.split('/').slice(1).join('/')}`) %> +<% const layoutParts = (page.layout || '').split('/') %> +<% if (layoutParts.length > 1) { %> + <%- partial(layoutParts[0] === 'ksio' ? `_ksio/layouts/${layoutParts.slice(1).join('/')}` : layoutParts.join('/')) %> <% } else { %> <%- partial('_ksio/layouts/page') %> <% } %> diff --git a/src/hexo/themes/lime/layout/_ksio/partials/footer.ejs b/src/hexo/themes/lime/layout/_ksio/partials/footer.ejs index 125e152..2d44925 100644 --- a/src/hexo/themes/lime/layout/_ksio/partials/footer.ejs +++ b/src/hexo/themes/lime/layout/_ksio/partials/footer.ejs @@ -1,6 +1,6 @@