Files
Fechin 172342c8a3 feat: modernize development toolchain
- Add comprehensive development tooling:
  * ESLint configuration with modern JavaScript rules
  * Prettier for consistent code formatting
  * Husky for Git hooks automation
  * lint-staged for pre-commit checks
  * Conventional Commits with commitlint
  * Stylelint for CSS code quality

- Fix CSS issues:
  * Resolve duplicate selectors in layout_note.css
  * Merge duplicate selectors in layout_list.css
  * Ensure stylelint compliance

- Apply consistent code formatting:
  * Format all JavaScript, CSS, and Markdown files
  * Standardize code style across the project
  * Fix console statement warnings in main.js

- Update project documentation:
  * Enhance README with modern development practices
  * Update package.json with new scripts and dependencies

This modernization establishes a robust development environment with
automated code quality checks, consistent formatting~
2025-06-18 14:09:17 +08:00

16 lines
430 B
JavaScript

const path = require('path');
const fs = require('hexo-fs');
const outputFile = path.resolve('./', 'source/ga_analytics_tops.json');
const cache = new Map();
hexo.extend.helper.register('topPosts', (maximum = 4) => {
let posts = cache.get(outputFile);
if (!posts) {
const content = fs.readFileSync(outputFile);
posts = JSON.parse(content);
cache.set(outputFile, posts);
}
return posts.slice(0, maximum);
});