Hexo Set Environment Variable
Recently I upgrade NexT theme to v8.14.1. The related post plugin
hexo-related-popular-posts
had been replaced by
hexo-related-posts
, which generates related posts by tf-idf
algorithm. However, the compute cost is a little bit heavy if you have
many posts. A good trade-off is enable this feature only for production
environment. The plugin hexo-related-posts
already takes this into account and use enable_env_name
to
disable its execution. Unfortunately, the document has typo so I takes
some time to fix it.
So how to set environment variable in Hexo?
Short
Answer:$ hexo <command> --<env_key> env_value
。
The following secitons will illustrate how to enable related post on production.