diff --git a/_config.cactus.yml b/_config.cactus.yml index 35bac0abc..f0c4e14b4 100644 --- a/_config.cactus.yml +++ b/_config.cactus.yml @@ -18,18 +18,24 @@ nav: articles: /archives/ tag: /tags/ projects: http://github.com/tzzs - Theme: https://imtzz.com/ + Theme: https://tzzs.github.io about: /about/ search: /search/ # Links to your social media accounts. -# The keys should correspond to Fontawesome icon names +# The 'icon' keys should correspond to Fontawesome icon names # (see https://fontawesome.com/icons?d=gallery&s=brands); # only 'mail' is an exception. +# You can optionally add a 'label' key to set the title attribute on the link. +# 'icon' value will be used as title when 'label' is missing. social_links: - github: http://github.com/tzzs - mail: mailto:tzzprc@outlook.com + - + icon: github + link: http://github.com/tzzs + - + icon: mail + link: mailto:tzzprc@outlook.com # Customize the overview with displaying a tagcloud on the index page. # Options: https://hexo.io/docs/helpers.html#tagcloud @@ -65,6 +71,15 @@ copyright: start_year: 2018 end_year: +# Customize the 404 page +# Options: +# - enabled: whether to enable the 404 page (404.html). +error_404: + enabled: true + title: "404 Page Not Found" + description: "The page you are looking for might have been removed, had its name changed, or is temporarily unavailable." + + ############################################################################## # Look and Feel ############################################################################## @@ -140,12 +155,20 @@ open_graph: # Enable MathJax support for Latex mathjax: enabled: false - + # Fill in your Disqus Comments Shortname to enable Disqus comments. disqus: enabled: false shortname: cactus-1 +# Fill in your Utterances data to enable Utterances comments +utterances: + enabled: false + repo: owner/githubrepo + issue_term: pathname + label: Comment + theme: github-dark + # Fill in your Google Analytics tracking ID to enable Google Analytics. google_analytics: enabled: false @@ -166,6 +189,7 @@ umami_analytics: enabled: false id: e77e68be-f6e4-4br3-9365-2b76b57cd571 host: https://analytics.domain.com + script_name: umami.js # Fill in you Gravatar email or hash if you want to use your gravatar as the # logo and/or favicons of you website. @@ -182,6 +206,6 @@ cdn: enable: true jquery: https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js clipboard: https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.7/clipboard.min.js - font_awesome: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css + font_awesome: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css justified_gallery_css: https://cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.8.1/css/justifiedGallery.min.css justified_gallery_js: https://cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js diff --git a/themes/cactus/.gitignore b/themes/cactus/.gitignore index bbebef6d7..c06a5bd3a 100644 --- a/themes/cactus/.gitignore +++ b/themes/cactus/.gitignore @@ -6,3 +6,4 @@ yarn.lock package-lock.json node_modules/ +.vscode \ No newline at end of file diff --git a/themes/cactus/README.md b/themes/cactus/README.md index 770070934..19bef5e46 100644 --- a/themes/cactus/README.md +++ b/themes/cactus/README.md @@ -6,11 +6,11 @@ A responsive, clean and simple [Hexo](http://hexo.io) theme for a personal websi ![screenshot](https://user-images.githubusercontent.com/2175271/137625287-24a4ac77-fbc9-4c99-a4cd-90455d93d13c.png) - ## Summary - [General](#general) - [Features](#features) +- [Prerequisites](#prerequisites) - [Install](#install) - [Configuration](#configuration) - [License](#license) @@ -29,44 +29,66 @@ A responsive, clean and simple [Hexo](http://hexo.io) theme for a personal websi - Support for local search - Projects list - I18n support -- Disqus integration +- Disqus / Utterances - Google analytics / Baidu Tongji / [Umami Analytics](https://umami.is) - Font Awesome icons - Simplicity +## Prerequisites + +1. In order to use this theme you must have installed [hexo](https://hexo.io/docs/). + +2. Create the `root` directory for the blog by initializing it with hexo: + + ```sh + $ hexo init my-blog + ``` + +3. Navigate into the new directory: + + ```sh + $ cd my-blog + ``` + ## Install + 1. In the `root` directory: - ```git + ```sh $ git clone https://github.com/probberechts/hexo-theme-cactus.git themes/cactus ``` -2. Change the `theme` property in the `config.yml` file. +2. Change the `theme` property in the `_config.yml` file. ```yml # theme: landscape theme: cactus ``` - See below for more information on how to customize this theme. - + + See below for more information on how to customize this theme. + 3. Create pages and articles with the `hexo new [layout] ` command. - For example, to create an "about me" page, run: + For example, to create an "about me" page, run: + ```sh $ hexo new page about ``` - This will create a new file in `source/about/index.md` - Similary, you can create a new article with + + This will create a new file in `source/about/index.md` + Similarly, you can create a new article with + ```sh $ hexo new post "hello world" ``` - and add some interesting content in `source/_posts/hello-world.md`. - + + and add some interesting content in `source/_posts/hello-world.md`. + 4. Run: `hexo generate` and `hexo server` 5. [Publish your blog](https://hexo.io/docs/one-command-deployment.html)! - ## Configuration + You can (and should) modify a couple of settings. An overview of all settings can be found in [_config.yml](_config.yml). The most important ones are discussed below. @@ -83,7 +105,6 @@ theme_config: colorscheme: white ``` - ```yml # themes/cactus/_config.yml colorscheme: dark @@ -91,7 +112,6 @@ colorscheme: dark This will override the default black colorscheme in `themes/cactus/_config.yml`. - ### Color scheme Currently, this theme is delivered with four color schemes: [dark](https://probberechts.github.io/hexo-theme-cactus/cactus-dark/public/), [light](https://probberechts.github.io/hexo-theme-cactus/cactus-light/public/), @@ -104,10 +124,9 @@ colorscheme: light Alternatively, you can easily create your own color scheme by creating a new file in `source/css/_colors`. - ### Navigation -Setup the navigation menu in the `_config.yml`: +Set up the navigation menu in the `_config.yml`: ```yml nav: @@ -118,7 +137,6 @@ nav: LINK_NAME: URL ``` - ### Blog posts list on home page You have two options for the list of blog posts on the home page: @@ -138,7 +156,6 @@ You have two options for the list of blog posts on the home page: show_all_posts: true ``` - ### Projects list Create a projects file `source/_data/projects.json` to show a list of your projects on the index page. @@ -158,7 +175,6 @@ Create a projects file `source/_data/projects.json` to show a list of your proje ] ``` - ### Social media links Cactus can automatically add links to your social media accounts. @@ -166,12 +182,20 @@ Therefore, update the theme's `_config.yml`: ```yml social_links: - github: your-github-url - twitter: your-twitter-url - NAME: your-NAME-url + - + icon: github + link: your-github-url + - + icon: twitter + label: "@your-twitter-handle" + link: your-twitter-url + - + icon: NAME + label: LABEL + link: your-NAME-url ``` -where `NAME` is the name of a [Font Awesome icon](https://fontawesome.com/icons?d=gallery&s=brands). +where `NAME` is the name of a [Font Awesome icon](https://fontawesome.com/icons?d=gallery&s=brands), and LABEL is an optional value used as a title attribute on the link (NAME value is used if LABEL is missing). ### Copyright years @@ -215,6 +239,7 @@ Otherwise, you can follow the steps below (E.g., to add a Japanese (ja) translat **Note: Cactus does not support multi-language sites.** ### RTL support + This theme support RTL languages for Persian and Arabic language. If you would like to use RTL layout, change `direction` attribute in `_config.yml` to `rtl`. Note that this also will change the font to [Vazir](https://github.com/rastikerdar/vazir-font), which is a Persian font. @@ -231,7 +256,6 @@ Set the `rss` field in the `_config.yml` to one of the following values: 2. `rss: atom.xml` sets a specific feed link. 3. `rss:`leave empty to use the [hexo-generator-feed](https://github.com/hexojs/hexo-generator-feed) plugin. - ### Analytics Add you Google, Baidu, Cloudflare or Umami Analytics `tracking_id` to the `_config.yml`. @@ -253,6 +277,7 @@ umami_analytics: enabled: false id: e77e68be-f6e4-4br3-9365-2b76b57cd571 host: https://analytics.domain.com + script_name: umami.js ``` ### CDN @@ -281,6 +306,10 @@ Only JQuery will be loaded from the specified CDN. ### Comments +Cactus supports two commenting systems: [Disqus](https://disqus.com) and [Utterances](https://utteranc.es). + +#### Disqus + First, create a site on Disqus: [https://disqus.com/admin/create/](http://disqus.com/admin/create/). Next, update the `_config.yml` file: @@ -293,6 +322,27 @@ disqus: where `SITENAME` is the name you gave your site on Disqus. +#### Utterances + +First, follow the instructions on the [oficial website](https://utteranc.es/) to setup an issue tracker Utterances will connect to. + +Next, update the `_config.yml` file: + +```yml +utterances: + enabled: true + repo: owner/githubrepo + issue_term: pathname + label: utteranc + theme: themename +``` + +where each of the parameters are the respective values ​​provided during the configuration of the Utterances: + +* `repo`: the repository Utterances will connect to. +* `issue_term`: the mapping between blog posts and GitHub issues. +* `label`: the label that will be assigned to issues created by Utterances +* `theme`: the selected Utterances theme. ### Code Highlighting @@ -303,6 +353,7 @@ highlight: COLORSCHEME_NAME ``` ### Tags and categories + Tags and categories can be included in the front-matter of your posts. For example: ```markdown @@ -343,7 +394,6 @@ nav: category: /categories/ ``` - ### Local search First, install the [hexo-generate-search](https://www.npmjs.com/package/hexo-generator-search) @@ -358,6 +408,7 @@ Next, create a page to display the search engine: ```sh $ hexo new page search ``` + and put `type: search` in the front-matter. ```markdown @@ -374,4 +425,5 @@ nav: ``` ## License + MIT diff --git a/themes/cactus/_config.yml b/themes/cactus/_config.yml index c2b31cb8c..6cf87edc8 100644 --- a/themes/cactus/_config.yml +++ b/themes/cactus/_config.yml @@ -17,19 +17,36 @@ nav: home: / about: /about/ articles: /archives/ - projects: projects_url + projects: http://github.com/probberechts # Links to your social media accounts. -# The keys should correspond to Fontawesome icon names +# The 'icon' keys should correspond to Fontawesome icon names # (see https://fontawesome.com/icons?d=gallery&s=brands); # only 'mail' is an exception. +# You can optionally add a 'label' key to set the title attribute on the link. +# 'icon' value will be used as title when 'label' is missing. social_links: - github: http://github.com/probberechts/cactus-dark - twitter: / - facebook: / - linkedin: / - mail: mailto:name@email.com + - + icon: github + link: http://github.com/probberechts/cactus-dark + - + icon: twitter + link: / + - + icon: facebook + link: / + - + icon: mail + link: mailto:name@email.com + - + icon: mastodon + label: mastodon.social + link: https://mastodon.social/@alice + - + icon: mastodon + label: fosstodon.org + link: https://fosstodon.org/@alice # Customize the overview with displaying a tagcloud on the index page. # Options: https://hexo.io/docs/helpers.html#tagcloud @@ -65,6 +82,15 @@ copyright: start_year: 2016 end_year: +# Customize the 404 page +# Options: +# - enabled: whether to enable the 404 page (404.html). +error_404: + enabled: true + title: "404 Page Not Found" + description: "The page you are looking for might have been removed, had its name changed, or is temporarily unavailable." + + ############################################################################## # Look and Feel ############################################################################## @@ -140,12 +166,20 @@ open_graph: # Enable MathJax support for Latex mathjax: enabled: false - + # Fill in your Disqus Comments Shortname to enable Disqus comments. disqus: enabled: false shortname: cactus-1 +# Fill in your Utterances data to enable Utterances comments +utterances: + enabled: false + repo: owner/githubrepo + issue_term: pathname + label: Comment + theme: github-dark + # Fill in your Google Analytics tracking ID to enable Google Analytics. google_analytics: enabled: false @@ -166,6 +200,7 @@ umami_analytics: enabled: false id: e77e68be-f6e4-4br3-9365-2b76b57cd571 host: https://analytics.domain.com + script_name: umami.js # Fill in you Gravatar email or hash if you want to use your gravatar as the # logo and/or favicons of you website. @@ -179,6 +214,6 @@ cdn: enable: true jquery: https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js clipboard: https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.7/clipboard.min.js - font_awesome: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css + font_awesome: https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css justified_gallery_css: https://cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.8.1/css/justifiedGallery.min.css justified_gallery_js: https://cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js diff --git a/themes/cactus/gulpfile.js b/themes/cactus/gulpfile.js index 08d02674f..4b9ef9b0e 100644 --- a/themes/cactus/gulpfile.js +++ b/themes/cactus/gulpfile.js @@ -1,17 +1,18 @@ -var decompress = require('gulp-decompress'); -var del = require('del'); -var download = require("gulp-download"); -var fs = require('fs'); -var gulp = require('gulp'); -var jshint = require('gulp-jshint'); -var path = require('path'); -var stylint = require('gulp-stylint'); -var stylish = require('jshint-stylish'); -var yaml = require('js-yaml'); +import decompress from 'gulp-decompress'; +import { deleteAsync } from 'del'; +import download from "gulp-download-stream"; +import fs from 'fs'; +import gulp from 'gulp'; +import path from 'path'; +import stylint from 'gulp-stylint'; +import stylelintFormatter from 'stylelint-formatter-pretty'; +import jshint from 'gulp-jshint'; +import jshintFormatter from 'jshint-stylish'; +import yaml from 'js-yaml'; gulp.task('lib:clean',function(){ - return del([ './source/lib/*' ]); + return deleteAsync([ './source/lib/*' ]); }) gulp.task('lib:fontAwesome',function(){ @@ -22,8 +23,13 @@ gulp.task('lib:fontAwesome',function(){ .pipe(gulp.dest('./source/lib/font-awesome')) }) -gulp.task('lib:mesloFont', function () { - return download('https://github.com/andreberg/Meslo-Font/blob/master/dist/v1.2/Meslo%20LG%20v1.2.zip?raw=true') +gulp.task('lib:download_mesloFont', function () { + return download('https://github.com/andreberg/Meslo-Font/raw/master/dist/v1.2.1/Meslo%20LG%20v1.2.1.zip?raw=true') + .pipe(gulp.dest("/tmp")); +}) + +gulp.task('lib:install_mesloFont', function () { + return gulp.src('/tmp/Meslo%20LG%20v1.2.1.zip') .pipe(decompress({ filter: file => path.extname(file.path) == '.ttf', strip: 1 @@ -31,7 +37,6 @@ gulp.task('lib:mesloFont', function () { .pipe(gulp.dest('./source/lib/meslo-LG')); }); - gulp.task('lib:vazirFont',function(){ return gulp.src([ 'node_modules/vazir-font/dist/*', @@ -61,7 +66,7 @@ gulp.task('lint:js', function() { return gulp.src([ './source/js/**/*.js', ]).pipe(jshint()) - .pipe(jshint.reporter(stylish)); + .pipe(jshint.reporter(jshintFormatter)); }); gulp.task('lint:stylus', function () { @@ -71,21 +76,17 @@ gulp.task('lint:stylus', function () { './source/css/_colors/*.styl' ]).pipe(stylint({ config: '.stylintrc', - reporter: { - reporter: 'stylint-stylish', - reporterOptions: { - verbose: true - } - } + reporters: [ + {formatter: stylelintFormatter, console: true} + ] })) - .pipe(stylint.reporter()); }); gulp.task('validate:config', function(cb) { - var themeConfig = fs.readFileSync(path.join(__dirname, '_config.yml')); + var themeConfig = fs.readFileSync(path.join(path.resolve(), '_config.yml')); try { - yaml.safeLoad(themeConfig); + yaml.load(themeConfig); cb(); } catch(error) { cb(new Error(error)); @@ -93,14 +94,14 @@ gulp.task('validate:config', function(cb) { }); gulp.task('validate:languages', function(cb) { - var languagesPath = path.join(__dirname, 'languages'); + var languagesPath = path.join(path.resolve(), 'languages'); var languages = fs.readdirSync(languagesPath); var errors = []; for (var i in languages) { var languagePath = path.join(languagesPath, languages[i]); try { - yaml.safeLoad(fs.readFileSync(languagePath), { - filename: path.relative(__dirname, languagePath) + yaml.load(fs.readFileSync(languagePath), { + filename: path.relative(path.resolve(), languagePath) }); } catch(error) { errors.push(error); @@ -114,8 +115,9 @@ gulp.task('validate:languages', function(cb) { }); gulp.task('lib', gulp.series( - 'lib:clean', 'lib:jQuery', 'lib:clipboard', 'lib:fontAwesome', 'lib:mesloFont', - 'lib:vazirFont', 'lib:justifiedGallery')); + 'lib:clean', 'lib:jQuery', 'lib:clipboard', 'lib:fontAwesome', + 'lib:download_mesloFont', 'lib:install_mesloFont', 'lib:vazirFont', + 'lib:justifiedGallery')); gulp.task('lint', gulp.parallel('lint:js', 'lint:stylus')); gulp.task('validate', gulp.parallel('validate:config', 'validate:languages')); gulp.task('default', gulp.parallel('lint', 'validate')); diff --git a/themes/cactus/languages/ar.yml b/themes/cactus/languages/ar.yml new file mode 100644 index 000000000..bb1f0c758 --- /dev/null +++ b/themes/cactus/languages/ar.yml @@ -0,0 +1,69 @@ +nav: + home: الرئيسية + about: معلومات عنّي + articles: منشورات + tag: تسمية + category: تصنيف + projects: مشاريع + search: بحث + +icons: + menu: القائمة + top: الأعلى + +footer: + copyright: حقوق النشر + +index: + find_me_on: يمكننا التواصل من خلال + enum_comma: "," + enum_and: و + articles: منشورات + projects: مشاريع + topics: مواضيع + most_recent: المنشور مؤخراً + +post: + desktop: + previous: المنشور السابق + next: المنشور التالي + back_to_top: العودة إلى الأعلى + share: مشاركة المنشور + mobile: + menu: القائمة + toc: المحتويات + back_to_top: العودة إلى الأعلى + share: مشاركة + +search: + search: بحث... + no_results: لم يتم العثور على نتائج. + +tag_cloud: + zero: لايوجد تسميات + +pagination: + page: الصفحة %d من أصل %d + +counter: + tag_cloud: + zero: لايوجد تسميات + one: "" + other: "" + + categories: + zero: لايوجد تصنيفات + one: "" + other: "" + + archive_posts: + zero: لايوجد منشورات. + one: "" + other: "" + +comments: + no_js: يرجى تفعيل JavaScript في المتصفح لعرض التعليقات. + +tooltip: + copy_tip: انسخ! + copied: تم النسخ! diff --git a/themes/cactus/languages/zh-CN.yml b/themes/cactus/languages/zh-CN.yml index b4bea24ed..166bc0f54 100644 --- a/themes/cactus/languages/zh-CN.yml +++ b/themes/cactus/languages/zh-CN.yml @@ -6,18 +6,22 @@ nav: tag: 标签 category: 分类 search: 搜索 + +icons: + menu: 目录 + top: 顶部 footer: copyright: Copyright index: find_me_on: 在这里找到我: - enum_comma: ' ' - enum_and: ' ' + enum_comma: ',' + enum_and: 和 articles: 文章 projects: 项目 topics: 标签 - most_recent: 最新的文章 + most_recent: 最新发布 post: desktop: @@ -35,12 +39,31 @@ search: search: 搜索... no_results: 抱歉,没有符合您搜索条件的结果。请换其它关键词再试。 +tag_cloud: + zero: 没有标签 + pagination: page: 第 %d 页,共 %d 页 + +counter: + tag_cloud: + zero: 没有标签 + one: "" + other: "" + + categories: + zero: 没有分类 + one: "" + other: "" + + archive_posts: + zero: 没有归档 + one: "" + other: "" comments: no_js: 加载评论需要在浏览器启用 JavaScript 脚本支持。 tooltip: - copy_tip: 复制到粘贴板! - copied: 复制成功! \ No newline at end of file + copy_tip: 复制到粘贴板! + copied: 复制成功! diff --git a/themes/cactus/layout/404.ejs b/themes/cactus/layout/404.ejs new file mode 100644 index 000000000..47964d934 --- /dev/null +++ b/themes/cactus/layout/404.ejs @@ -0,0 +1,9 @@ +<article class="post" itemscope itemtype="http://schema.org/BlogPosting"> + <%- partial('_partial/post/gallery') %> + <div class="content" itemprop="articleBody"> + <% if (theme.error_404.enabled && theme.error_404.title && theme.error_404.description ) { %> + <h1><%= theme.error_404.title %></h1> + <p><%= theme.error_404.description %></p> + <% } %> + </div> +</article> \ No newline at end of file diff --git a/themes/cactus/layout/_partial/comments.ejs b/themes/cactus/layout/_partial/comments.ejs index 54bc30984..9afbf9835 100644 --- a/themes/cactus/layout/_partial/comments.ejs +++ b/themes/cactus/layout/_partial/comments.ejs @@ -5,3 +5,10 @@ </div> </div> <% } %> +<% if(page.comments && theme.utterances.enabled){ %> + <div class="blog-post-comments"> + <div id="utterances_thread"> + <noscript><%= __('comments.no_js') %></noscript> + </div> + </div> +<% } %> \ No newline at end of file diff --git a/themes/cactus/layout/_partial/google_analytics.ejs b/themes/cactus/layout/_partial/google_analytics.ejs new file mode 100644 index 000000000..7bfdfc741 --- /dev/null +++ b/themes/cactus/layout/_partial/google_analytics.ejs @@ -0,0 +1,10 @@ +<!-- Google Analytics --> +<% if (theme.google_analytics.enabled && theme.google_analytics.id){ %> + <script async src="https://www.googletagmanager.com/gtag/js?id=<%= theme.google_analytics.id %>"></script> + <script> + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + gtag('config', '<%= theme.google_analytics.id %>'); + </script> +<% } %> diff --git a/themes/cactus/layout/_partial/head.ejs b/themes/cactus/layout/_partial/head.ejs index 1306c7c43..91806da5a 100644 --- a/themes/cactus/layout/_partial/head.ejs +++ b/themes/cactus/layout/_partial/head.ejs @@ -49,6 +49,9 @@ <% } %> <!-- title --> <title><%= page_title() %> + + <%- partial('./google_analytics.ejs') %> + <%- partial('./umami_analytics.ejs') %> <%- css('css/style') %> diff --git a/themes/cactus/layout/_partial/header.ejs b/themes/cactus/layout/_partial/header.ejs index 9070fe30a..a31a51251 100644 --- a/themes/cactus/layout/_partial/header.ejs +++ b/themes/cactus/layout/_partial/header.ejs @@ -1,24 +1,28 @@