Removed the keyword generator

It didn't really work, added a bunch to the overall file size, and computer-generated keywords just won't compare to human created ones, unless you're to use AI or a particularly advanced algorithm, which I feel is outside the scope of the project.

I've left the class in place, so if needed, it'll be really easy to add it back
This commit is contained in:
Belle Aerni 2023-01-19 18:01:03 -08:00
parent 97e6a8a4e6
commit ecf94d36da
10 changed files with 40 additions and 103 deletions

View file

@ -15,7 +15,6 @@
"elgigi/commonmark-emoji": "^2.0", "elgigi/commonmark-emoji": "^2.0",
"twig/twig": "^3.5", "twig/twig": "^3.5",
"shapecode/twig-string-loader": "^1.1", "shapecode/twig-string-loader": "^1.1",
"donatello-za/rake-php-plus": "^1.0",
"embed/embed": "^4.4", "embed/embed": "^4.4",
"nyholm/psr7": "^1.5" "nyholm/psr7": "^1.5"
}, },

125
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "2b32ca6ab5978e9e11f071023d5dd4c5", "content-hash": "c5ca069c1cb40f460516e523125a2eca",
"packages": [ "packages": [
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -157,66 +157,6 @@
}, },
"time": "2022-10-27T11:44:00+00:00" "time": "2022-10-27T11:44:00+00:00"
}, },
{
"name": "donatello-za/rake-php-plus",
"version": "v1.0.18",
"source": {
"type": "git",
"url": "https://github.com/Donatello-za/rake-php-plus.git",
"reference": "e9e9c0862b3dc953d288e8f42c76e4ceaeca0619"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Donatello-za/rake-php-plus/zipball/e9e9c0862b3dc953d288e8f42c76e4ceaeca0619",
"reference": "e9e9c0862b3dc953d288e8f42c76e4ceaeca0619",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-mbstring": "*",
"php": ">=5.4.0"
},
"require-dev": {
"php": ">=5.5.0",
"phpunit/phpunit": "~4.0|~5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.13-dev"
}
},
"autoload": {
"psr-4": {
"DonatelloZa\\RakePlus\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Don Schoeman",
"email": "ta.maximus@gmail.com"
}
],
"description": "Yet another PHP implementation of the Rapid Automatic Keyword Extraction algorithm (RAKE).",
"homepage": "https://github.com/Donatello-za/rake-php-plus",
"keywords": [
"Algorithm",
"automatic",
"extraction",
"keyword",
"rake",
"rapid"
],
"support": {
"issues": "https://github.com/Donatello-za/rake-php-plus/issues",
"source": "https://github.com/Donatello-za/rake-php-plus"
},
"time": "2022-02-23T18:42:03+00:00"
},
{ {
"name": "elgigi/commonmark-emoji", "name": "elgigi/commonmark-emoji",
"version": "2.0.0", "version": "2.0.0",
@ -700,16 +640,16 @@
}, },
{ {
"name": "nette/utils", "name": "nette/utils",
"version": "v3.2.8", "version": "v3.2.9",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/utils.git", "url": "https://github.com/nette/utils.git",
"reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368" "reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", "url": "https://api.github.com/repos/nette/utils/zipball/c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c",
"reference": "02a54c4c872b99e4ec05c4aec54b5a06eb0f6368", "reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -719,6 +659,7 @@
"nette/di": "<3.0.6" "nette/di": "<3.0.6"
}, },
"require-dev": { "require-dev": {
"jetbrains/phpstorm-attributes": "dev-master",
"nette/tester": "~2.0", "nette/tester": "~2.0",
"phpstan/phpstan": "^1.0", "phpstan/phpstan": "^1.0",
"tracy/tracy": "^2.3" "tracy/tracy": "^2.3"
@ -779,9 +720,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nette/utils/issues", "issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v3.2.8" "source": "https://github.com/nette/utils/tree/v3.2.9"
}, },
"time": "2022-09-12T23:36:20+00:00" "time": "2023-01-18T03:26:20+00:00"
}, },
{ {
"name": "nyholm/psr7", "name": "nyholm/psr7",
@ -1857,16 +1798,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.15.2", "version": "v4.15.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039",
"reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1907,9 +1848,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3"
}, },
"time": "2022-11-12T15:38:23+00:00" "time": "2023-01-16T22:05:37+00:00"
}, },
{ {
"name": "phar-io/manifest", "name": "phar-io/manifest",
@ -2024,16 +1965,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.9.11", "version": "1.9.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464" "reference": "e5fcc96289cf737304286a9b505fbed091f02e58"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/60f3d68481eef216199eae7a2603cd5fe124d464", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58",
"reference": "60f3d68481eef216199eae7a2603cd5fe124d464", "reference": "e5fcc96289cf737304286a9b505fbed091f02e58",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2063,7 +2004,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.9.11" "source": "https://github.com/phpstan/phpstan/tree/1.9.14"
}, },
"funding": [ "funding": [
{ {
@ -2079,7 +2020,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-12T14:04:13+00:00" "time": "2023-01-19T10:47:09+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -2401,20 +2342,20 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.5.27", "version": "9.5.28",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e",
"reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.3.1", "doctrine/instantiator": "^1.3.1 || ^2",
"ext-dom": "*", "ext-dom": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*", "ext-libxml": "*",
@ -2483,7 +2424,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28"
}, },
"funding": [ "funding": [
{ {
@ -2499,20 +2440,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-12-09T07:31:23+00:00" "time": "2023-01-14T12:32:24+00:00"
}, },
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "0.15.5", "version": "0.15.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rectorphp/rector.git", "url": "https://github.com/rectorphp/rector.git",
"reference": "b27945f63527b540dba09a4f4612bc738da9c285" "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/b27945f63527b540dba09a4f4612bc738da9c285", "url": "https://api.github.com/repos/rectorphp/rector/zipball/a43370e1f4c47aaa96c0f85bf9db73db1be7552f",
"reference": "b27945f63527b540dba09a4f4612bc738da9c285", "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2547,7 +2488,7 @@
"description": "Instant Upgrade and Automated Refactoring of any PHP code", "description": "Instant Upgrade and Automated Refactoring of any PHP code",
"support": { "support": {
"issues": "https://github.com/rectorphp/rector/issues", "issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/0.15.5" "source": "https://github.com/rectorphp/rector/tree/0.15.7"
}, },
"funding": [ "funding": [
{ {
@ -2555,7 +2496,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-01-12T19:13:08+00:00" "time": "2023-01-13T21:14:19+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",

View file

@ -6,3 +6,5 @@ parameters:
analyse: analyse:
- src/Vendor - src/Vendor
- src/Cache - src/Cache
- src/AntCMS/AntKeywords.php

View file

@ -45,7 +45,6 @@ AntCMS stores its configuration in the human-readable "yaml" file format. The ma
- `siteTitle: AntCMS` - This configuration sets the title of your AntCMS website. - `siteTitle: AntCMS` - This configuration sets the title of your AntCMS website.
- `forceHTTPS: true` - Set to 'true' by default, enables HTTPs redirection. - `forceHTTPS: true` - Set to 'true' by default, enables HTTPs redirection.
- `activeTheme: Default` - Sets what theme AntCMS should use. should match the folder name of the theme you want to use. - `activeTheme: Default` - Sets what theme AntCMS should use. should match the folder name of the theme you want to use.
- `generateKeywords: false` - AntCMS can automatically generate keywords for content if they aren't provided. Due to the limitations of this feature, it's currently disabled while we evaluate it's value in the project, but you can manually enable it if you want.
- `enableCache: true` - Enables or disables file caching in AntCMS. - `enableCache: true` - Enables or disables file caching in AntCMS.
- `admin:` - `admin:`
- `username: 'Admin'` - The username used to access any parts of AntCMS that may require authentication. - `username: 'Admin'` - The username used to access any parts of AntCMS that may require authentication.

View file

@ -178,7 +178,7 @@ class AntCMS
'title' => 'AntCMS', 'title' => 'AntCMS',
'author' => 'AntCMS', 'author' => 'AntCMS',
'description' => 'AntCMS', 'description' => 'AntCMS',
'keywords' => trim($AntKeywords->generateKeywords($pageContent)), 'keywords' => '',
]; ];
// First get the AntCMS header and store it in the matches varible // First get the AntCMS header and store it in the matches varible
@ -199,8 +199,7 @@ class AntCMS
$pageHeaders['description'] = trim($matches[1] ?? 'AntCMS'); $pageHeaders['description'] = trim($matches[1] ?? 'AntCMS');
preg_match('/Keywords: (.*)/', $header, $matches); preg_match('/Keywords: (.*)/', $header, $matches);
$keywods = $matches[1] ?? $AntKeywords->generateKeywords($pageContent); $pageHeaders['keywords'] = trim($matches[1] ?? '');
$pageHeaders['keywords'] = trim($keywods);
} }
return $pageHeaders; return $pageHeaders;

View file

@ -11,7 +11,6 @@ class AntConfig
'siteInfo', 'siteInfo',
'forceHTTPS', 'forceHTTPS',
'activeTheme', 'activeTheme',
'generateKeywords',
'enableCache', 'enableCache',
'admin', 'admin',
'debug', 'debug',
@ -30,7 +29,6 @@ class AntConfig
], ],
'forceHTTPS' => true, 'forceHTTPS' => true,
'activeTheme' => 'Default', 'activeTheme' => 'Default',
'generateKeywords' => false,
'enableCache' => true, 'enableCache' => true,
'admin' => array( 'admin' => array(
'username' => 'Admin', 'username' => 'Admin',

View file

@ -23,7 +23,7 @@ class AntPages
$pageHeader = AntCMS::getPageHeaders($pageContent); $pageHeader = AntCMS::getPageHeaders($pageContent);
// Because we are only getting a list of files with the 'md' extension, we can blindly strip off the extension from each path. // Because we are only getting a list of files with the 'md' extension, we can blindly strip off the extension from each path.
// Doing this creates more profesional URLs as AntCMS will automatically add the 'md' extenstion during the page rendering process. // Doing this creates more profesional looking URLs as AntCMS can automatically add the 'md' extenstion during the page rendering process.
$pageFunctionalPath = substr(str_replace(antContentPath, "", $page), 0, -3); $pageFunctionalPath = substr(str_replace(antContentPath, "", $page), 0, -3);
if ($pageFunctionalPath == '/index') { if ($pageFunctionalPath == '/index') {
@ -40,6 +40,8 @@ class AntPages
'functionalPagePath' => $pageFunctionalPath, 'functionalPagePath' => $pageFunctionalPath,
'showInNav' => true, 'showInNav' => true,
); );
// Move the index page to the first item in the page list, so it appears as the first item in the navbar.
if ($pageFunctionalPath === '/') { if ($pageFunctionalPath === '/') {
array_unshift($pageList, $currentPage); array_unshift($pageList, $currentPage);
} else { } else {

View file

@ -48,7 +48,6 @@ AntCMS stores its configuration in the human-readable yaml file format. The main
- `siteTitle: AntCMS` - This configuration sets the title of your AntCMS website. - `siteTitle: AntCMS` - This configuration sets the title of your AntCMS website.
- `forceHTTPS: true` - Set to 'true' by default, enables HTTPs redirection. - `forceHTTPS: true` - Set to 'true' by default, enables HTTPs redirection.
- `activeTheme: Default` - Sets what theme AntCMS should use. should match the folder name of the theme you want to use. - `activeTheme: Default` - Sets what theme AntCMS should use. should match the folder name of the theme you want to use.
- `generateKeywords: true` - AntCMS will automatically attempt to generate keywords for each page if they don't have keywords defined. Set this to `false` to disable this. Note: this feature is very limited, we highly suggest manually creating keywords for your content.
- `enableCache: true` - Enables or disables file caching in AntCMS. - `enableCache: true` - Enables or disables file caching in AntCMS.
- `admin:` - `admin:`
- `username: 'Admin'` - The username used to access any parts of AntCMS that may require authentication. - `username: 'Admin'` - The username used to access any parts of AntCMS that may require authentication.

View file

@ -15,7 +15,6 @@ class ConfigTest extends TestCase
'siteInfo', 'siteInfo',
'forceHTTPS', 'forceHTTPS',
'activeTheme', 'activeTheme',
'generateKeywords',
'enableCache', 'enableCache',
'admin', 'admin',
'debug', 'debug',

View file

@ -2,7 +2,6 @@ siteInfo:
siteTitle: 'AntCMS' siteTitle: 'AntCMS'
forceHTTPS: true forceHTTPS: true
activeTheme: Default activeTheme: Default
generateKeywords: false
enableCache: true enableCache: true
admin: admin:
username: Admin username: Admin