diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 83c8bff..4aa6feb 100755 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -16,10 +16,12 @@ All options show an example configuartion value and the variable type + an expla | root_path | "/path/to/root/of/website" | String | Anything in this directory will be in the webroot, so put favicon.ico and anything else here. | | data_storage | "json" | String | JSON is currently the only supported format, but SQL is going to be added/is a work in progress | | cache_data | true | Boolean | Not caching data means you can edit the posts, users, comments etc, maunally and not have to restart the server, however, for large instances this is not reccomended as it takes longer to load the required data. Note: config.json always needs a restart | +| request_data_limit | 20 | Integer | The maximum number of objects to return (latest), so if set to 20, then only the 20 most recent posts will ever show | +| root_path | '/var/www/blog_root' | String | Relative or Absolute path to the root directory of your static content, holds files such as favicon.ico, custom.css and robots.txt | ## Basic Customisation | name | example value | variable type | explanation | |-----------------|----------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| -|locale|"en-GB"|String|Your locale, see [/locales](/locales) for a list of all locales (you can open a PR for a new translation too)| +|locale|"en-US"|String|Your locale, see [/locales](/locales) for a list of all locales (you can open a PR for a new translation too)| |seperator|"\
"|String|By default, this will go inbetween posts and generally to seperate out content on pages.| |site_name|"Pete's Blogging Site!"|String|It's the name of your blog site, a human readable string.| |site_description|"Read my blogs!"|String|This is what %W represents; it's the description of your instance, a human readable string.| diff --git a/example-config.json b/example-config.json index f8cbf4f..9c1cf7e 100755 --- a/example-config.json +++ b/example-config.json @@ -9,7 +9,7 @@ "cache_data": false, "allow_signup": true, "site_description": "Read my blogs!", - "timeline_length": 20, + "request_data_limit": 20, "enable_hitcount": true, "charset": "UTF-8", "root_path": "../webroot/", diff --git a/src/data.js b/src/data.js index 763ad3a..eaad5fe 100644 --- a/src/data.js +++ b/src/data.js @@ -78,10 +78,13 @@ export function getdata(data_type, key=-1, value=-1) { case 'comments': result = func.require_module(`../data/${data_type}.json`) if (key != -1) { + if (key == 'id' && value < result.length) { // id is the index + return result[value] + } return result[func.find_key_value_pair(result, key, value)] return -1 // This index doesn't exist } - return result + return result.slice(- config['data_request_limit']) break; case 'hitcount': result = func.require_module('../data/data.json') // This file is actually called data.json