Created a per-post hitcount as well a writedata() function that can

write to a particular index or to a whole data type
This commit is contained in:
2025-10-02 13:34:55 +01:00
parent 17919e3078
commit 2ada1d970f
5 changed files with 57 additions and 11 deletions

View File

@@ -124,12 +124,3 @@ export function render_md(content) {
return md.render(content)
};
// Literally just +1 to the hitcount
export function increment_hitcount() {
if (config.data_storage == 'json') {
let other_data = require('../data/data.json');
other_data.hitcount += 1
console.log(`/ Is loaded, hitcount: ${other_data.hitcount}`)
fs.writeFileSync(`../data/data.json`, `${JSON.stringify(other_data)}`, 'utf-8');
}
};