The total number of articles #4868
Unanswered
wxydejoy
asked this question in
Question / Answer
Replies: 3 comments 2 replies
-
You can pass the variable to front-end via template engine: <script>
let total_number_of_articles = {{ site.posts.length }};
</script> |
Beta Was this translation helpful? Give feedback.
2 replies
-
emmm |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can get it as follows, if you using Hexo API. const Hexo = require('hexo');
const hexo = new Hexo(process.cwd(), {silent: true});
hexo.init().then(() => {
hexo.load().then(() => {
const posts = hexo.locals.get('posts');
console.log(posts.length);
const pages = hexo.locals.get('pages');
console.log(pages.length);
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to get the total number of articles on the deployed website. Is there any way?
At present, the known method is to find the number of links on the archive page
emmm
i want to get other people's post number
Beta Was this translation helpful? Give feedback.
All reactions