Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
x-hexo-app-express
Advanced tools
Readme
It lets you use hexo app(s) as route(s) in your express/connect app
Do these steps below, one by one to have a clean blog using this package + hexo. These steps are just about a sample project. You can use this information to develop your blog in any shapes.
1.1 - Make a sub-directory in wherever you want inside of your project directory. e.g. if we wanted to make it in the root path of our project, use this command:
$ mkdir blog
1.2 - Enter this command to install hexo-cli globally.
$ sudo npm i hexo-cli -g
1.3 - Go to your blog's directory you made (in step 1.1) and enter this in terminal to initialize hexo, there:
$ hexo init
and after that, the blog directory tree should be something like this:
./
├── _config.yml
├── node_modules
│ └── ...
├── package.json
├── package-lock.json
├── scaffolds
│ ├── draft.md
│ ├── page.md
│ └── post.md
├── source
│ └── _posts
│ └── hello-world.md
└── themes
└── landscape
├── _config.yml
├── Gruntfile.js
├── languages
│ ├── default.yml
│ ├── de.yml
│ ├── es.yml
│ ├── fr.yml
│ ├── ja.yml
│ ├── ko.yml
│ ├── nl.yml
│ ├── no.yml
│ ├── pt.yml
│ ├── ru.yml
│ ├── zh-CN.yml
│ └── zh-TW.yml
├── layout
│ ├── archive.ejs
│ ├── category.ejs
│ ├── index.ejs
│ ├── layout.ejs
│ ├── page.ejs
│ ├── _partial
│ │ ├── after-footer.ejs
│ │ ├── archive.ejs
│ │ ├── archive-post.ejs
│ │ ├── article.ejs
│ │ ├── footer.ejs
│ │ ├── gauges-analytics.ejs
│ │ ├── google-analytics.ejs
│ │ ├── head.ejs
│ │ ├── header.ejs
│ │ ├── mobile-nav.ejs
│ │ ├── post
│ │ │ ├── category.ejs
│ │ │ ├── date.ejs
│ │ │ ├── gallery.ejs
│ │ │ ├── nav.ejs
│ │ │ ├── tag.ejs
│ │ │ └── title.ejs
│ │ └── sidebar.ejs
│ ├── post.ejs
│ ├── tag.ejs
│ └── _widget
│ ├── archive.ejs
│ ├── category.ejs
│ ├── recent_posts.ejs
│ ├── tagcloud.ejs
│ └── tag.ejs
├── LICENSE
├── package.json
├── README.md
├── scripts
│ └── fancybox.js
└── source
├── css
│ ├── _extend.styl
│ ├── fonts
│ │ ├── FontAwesome.otf
│ │ ├── fontawesome-webfont.eot
│ │ ├── fontawesome-webfont.svg
│ │ ├── fontawesome-webfont.ttf
│ │ └── fontawesome-webfont.woff
│ ├── images
│ │ └── banner.jpg
│ ├── _partial
│ │ ├── archive.styl
│ │ ├── article.styl
│ │ ├── comment.styl
│ │ ├── footer.styl
│ │ ├── header.styl
│ │ ├── highlight.styl
│ │ ├── mobile.styl
│ │ ├── sidebar-aside.styl
│ │ ├── sidebar-bottom.styl
│ │ └── sidebar.styl
│ ├── style.styl
│ ├── _util
│ │ ├── grid.styl
│ │ └── mixin.styl
│ └── _variables.styl
├── fancybox
│ ├── blank.gif
│ ├── fancybox_loading@2x.gif
│ ├── fancybox_loading.gif
│ ├── fancybox_overlay.png
│ ├── fancybox_sprite@2x.png
│ ├── fancybox_sprite.png
│ ├── helpers
│ │ ├── fancybox_buttons.png
│ │ ├── jquery.fancybox-buttons.css
│ │ ├── jquery.fancybox-buttons.js
│ │ ├── jquery.fancybox-media.js
│ │ ├── jquery.fancybox-thumbs.css
│ │ └── jquery.fancybox-thumbs.js
│ ├── jquery.fancybox.css
│ ├── jquery.fancybox.js
│ └── jquery.fancybox.pack.js
└── js
└── script.js
1.4 - In the blog directory, enter this command in terminal to install x-hexo-app-express package, there:
$ npm i x-hexo-app-express --save
1.5 - Configure your blog according to The Configurations Section.
1.6 - Create a index.js
file in your blog's root directory.
e.g. if you want to make it using a bash terminal, enter this command below:
$ touch index.js
1.7 - Fill index.js
file (inside of your blog's directory) with this scripts:
'use strict';
exports = module.exports = function(app){
var blogDirPath = "/absolute/path/to/your/blog's/root/directory";
var Hexo = require("hexo");
var hexo = new Hexo(blogDirPath, {});
return require('x-hexo-app-express')(app, hexo);
};
1.8 - Open the file which you want to use x-hexo-app-express in your (connect|express|...) application. Then, use these scripts to use hexo as a route in your application:
// some of your codes ...
// e.g. 'app' is your (connect|express|...) application
var hexoAppExpress = require("./relative/path/to/your/blog's/root/directory")(app);
// some of your codes ...
1.9 - After all previous steps, it's time to run your main application which you added x-hexo-app-express to one of it's routes. e.g. after running, if hexo worked well; it should log something like this in your app's terminal:
INFO Start processing
INFO [x-hexo-app-express] is running on route /blog
and you have simply succeed; Congratulations !!!
I suggest you read The 'Using Hexo Themes' Section after being succeed.
There are 2 ways for x-hexo-app-express configuration.
_configs.yml
FileThere is a _configs.yml
file inside of your blog's directory.
Add these configuration lines to _configs.yml
content:
# x-hexo-app-express
app:
log: false,
compress: false,
header: true,
serveStatic: false
route: /
The configs above are default configs, too.
(>= v2.0.5) Recommended: Simply enter an object to the third argument of this package's function:
hexoApp(
yourApp,
hexo,
{ // The Configs/Options
log: false,
compress: false,
header: true,
serveStatic: false,
route: "/"
});
log
: logs some information about hexo state.
compress
: whether use the compression package or not.
header
: whether set header 'X-Powered-By': 'Hexo'
or not.
serveStatic
: whether use hexo.load() or hexo.watch() for serving blog.
route
: determines that hexo runs on which route of your (connect|express|...) application.
Note: Determining the
route
in it's configs is SO IMPORTANT; because it can cause your app to not load pages correctly. so be careful about it and I recommend you to use the second approach for configuration.
Note: Use the complete route string which x-hexo-app-express connects to your (connect|express|...) app in it.
In hexo themes be careful when you use paths to blog's public sources, routes and ...
There is a problem in the archive link of hexo's landscape theme.
If you faced a problem like that, use the url_for() helper and the helpers which use url_for, like:
then add a slash '/' after the archives page
url to solve that.
FAQs
It lets you use hexo (express) as a route in your main express/connect app
The npm package x-hexo-app-express receives a total of 17 weekly downloads. As such, x-hexo-app-express popularity was classified as not popular.
We found that x-hexo-app-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.