Skip to content

Commit

Permalink
Merge branch 'main' of github.com:vormkracht10/laravel-seo-scanner in…
Browse files Browse the repository at this point in the history
…to too-long-sentences-check
  • Loading branch information
Baspa committed Aug 17, 2023
2 parents c8fab8a + 57abf96 commit 1fd49dc
Show file tree
Hide file tree
Showing 11 changed files with 505 additions and 49 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to `laravel-seo` will be documented in this file.

## v3.1.0 - 2023-08-17

**Full Changelog**: https://github.com/vormkracht10/laravel-seo-scanner/compare/v3.0.0...v3.1.0

## v3.0.0 - 2023-08-17

### What's Changed
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## Introduction

This package is your guidance to get a better SEO score on search engines. Laravel SEO Scanner scans your code and crawls the routes from your app. The package has 22 checks that will check on performance, configurations, use of meta tags and content quality.
This package is your guidance to get a better SEO score on search engines. Laravel SEO Scanner scans your code and crawls the routes from your app. The package has 24 checks that will check on performance, configurations, use of meta tags and content quality.

Easily configure which routes to scan, exclude or include specific checks or even add your own checks! Completing checks will further improve the SEO score and thus increase the chance of ranking higher at the search engines.

Expand All @@ -28,7 +28,7 @@ Easily configure which routes to scan, exclude or include specific checks or eve
- [Running the scanner in a local environment](#running-the-scanner-in-a-local-environment)
- [Scanning routes](#scanning-routes)
- [Scanning a single route](#scanning-a-single-route)
- [Scanning a single route in an SPA application](#scanning-a-single-route-in-an-spa-application)
- [Scanning routes in an SPA application](#scanning-routes-in-an-spa-application)
- [Scan model urls](#scan-model-urls)
- [Saving scans into the database](#saving-scans-into-the-database)
- [Listening to events](#listening-to-events)
Expand Down Expand Up @@ -57,7 +57,7 @@ composer require vormkracht10/laravel-seo-scanner

If you want to scan pages that are rendered using Javascript, for example Vue or React, you need to install Puppeteer. You can install it using the following command:

> If you want to know how to scan Javascript rendered pages, check out [Scanning a single route in an SPA application](#scanning-a-single-route-in-an-spa-application). Want to know more about Puppeteer? Check out the [Puppeteer documentation](https://pptr.dev/).
> If you want to know how to scan Javascript rendered pages, check out [Scanning routes in an SPA application](#scanning-routes-in-an-spa-application). Want to know more about Puppeteer? Check out the [Puppeteer documentation](https://pptr.dev/).
```bash
npm install puppeteer
Expand Down Expand Up @@ -222,6 +222,18 @@ return [
'User-Agent' => 'Laravel SEO Scanner/1.0',
],
],

/*
|--------------------------------------------------------------------------
| Javascript rendering
|--------------------------------------------------------------------------
|
| If your website uses javascript to render the content, you can enable
| javascript rendering. This will use a headless browser to render
| the content.
|
*/
'javascript' => false,
];
```

Expand All @@ -244,6 +256,9 @@ These checks are available in the package. You can add or remove checks in the c
✅ The page contains no broken images. <br>
✅ Length of the content is at least 2100 characters. <br>
✅ No more than 20% of the content contains too long sentences (more than 20 words). <br>
✅ A minimum of 30% of the sentences contain a transition word or phrase. <br>

> Note: To change the locale of the transition words, you can publish the config file and change the locale in the config file. The default locale is `null` which uses the language of your `app` config. If set to `nl` or `en`, the transition words will be in Dutch or English. If you want to add more locales, you can create a pull request.
### Meta

Expand Down Expand Up @@ -316,9 +331,9 @@ php artisan seo:scan-url https://vormkracht10.nl

> Note: The command will only check the SEO score of the url and output the score in the CLI. It will not save the score to the database.
### Scanning a single route in an SPA application
### Scanning routes in an SPA application

If you have an SPA application, you may want to check the SEO score of a specific route. You can do this by running the following command:
If you have an SPA application, you can enable javascript rendering. This will use a headless browser to render the content. To enable javascript rendering, set the `javascript` option to `true` in the config file. You can also enable javascript rendering for a single route by adding the `--javascript` option to the command:

```bash
php artisan seo:scan-url https://vormkracht10.nl --javascript
Expand Down
40 changes: 24 additions & 16 deletions config/seo.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Default options
|--------------------------------------------------------------------------
|
| The following array lists the default options for the application.
|
*/
// en, nl or null (which will use the app locale)
'language' => null,

/*
|--------------------------------------------------------------------------
| Cache
Expand Down Expand Up @@ -153,21 +165,17 @@
'headers' => [
'User-Agent' => 'Laravel SEO Scanner/1.0',
],

/*
|--------------------------------------------------------------------------
| Http throttle
|--------------------------------------------------------------------------
|
| Here you can specify the throttle options of the http client. This
| will throttle the requests to the same domain. This is useful
| when you have a lot of routes to check.
|
*/
'throttle' => [
'enabled' => false,
'max_requests' => 10,
'seconds' => 1,
],
],

/*
|--------------------------------------------------------------------------
| Javascript rendering
|--------------------------------------------------------------------------
|
| If your website uses javascript to render the content, you can enable
| javascript rendering. This will use a headless browser to render
| the content.
|
*/
'javascript' => false,
];
86 changes: 84 additions & 2 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{
"accordingly": "accordingly",
"additionally": "additionally",
"admittedly": "admittedly",
"after": "after",
"afterward": "afterward",
"all in all": "all in all",
"although": "although",
"an example of this is": "an example of this is",
"as a result": "as a result",
"as well as": "as well as",
"because": "because",
"before": "before",
"besides": "besides",
"but also": "but also",
"certainly": "certainly",
"compared to": "compared to",
"consequently": "consequently",
"conversely": "conversely",
"due to": "due to",
"during": "during",
"even though": "even though",
"eventually": "eventually",
"failed.configuration.nofollow.meta": "The page contains a nofollow meta tag, while it should not.",
"failed.configuration.nofollow.tag": "The page contains a nofollow tag, while it should not.",
"failed.configuration.noindex.meta": "The page contains a noindex meta tag, while it should not.",
Expand All @@ -15,9 +37,12 @@
"failed.content.no_heading": "The page does not contain any h1 tag, while it should.",
"failed.content.no_title": "The page does not contain a title tag, while it should.",
"failed.content.title_length": "The page title is :actualValue characters long. It should be max :expectedValue characters long.",
"failed.content.too_long_sentence": "The page contains :actualValue sentences that are too long.",
"failed.content.transition_words_ratio_check.no_phrases_found": "The page does not contain any transition words.",
"failed.content.transition_words_ratio_check.too_few_transition_words": "The page contains too few transition words. The recommended minimum is 30%, while the actual number is :actualValue%.",
"failed.meta.description": "The page does not contain a description meta tag, while it should.",
"failed.meta.keyword_in_title_check": "The page title does not contain the focus keyword, while it should.",
"failed.meta.keyword_in_first_paragraph_check": "The page does not contain the focus keyword in the first paragraph, while it should.",
"failed.meta.keyword_in_title_check": "The page title does not contain the focus keyword, while it should.",
"failed.meta.no_lang": "The page does not contain a lang attribute, while it should.",
"failed.meta.open_graph_image": "The page does not contain an open graph image, while it should.",
"failed.meta.open_graph_image.broken": "The page contains a broken open graph image. This image was found: :actualValue.",
Expand All @@ -31,5 +56,62 @@
"failed.performance.response": "The page returned a response code other than :expectedValue. The actual response code was :actualValue.",
"failed.performance.ttfb": "The page took too long to load (max :expectedValuems). The actual time was :actualValuems.",
"failed.performance.ttfb.missing_url": "We could not get the TTFB for this page.",
"failed.content.too_long_sentence": "The page contains :actualValue sentences that are too long."
"finally": "finally",
"first": "first",
"for example": "for example",
"for instance": "for instance",
"furthermore": "furthermore",
"granted": "granted",
"however": "however",
"in addition": "in addition",
"in comparison": "in comparison",
"in conclusion": "in conclusion",
"in contrast": "in contrast",
"in other words": "in other words",
"in particular": "in particular",
"in summary": "in summary",
"in the future": "in the future",
"in the meantime": "in the meantime",
"in the past": "in the past",
"in this case": "in this case",
"indeed": "indeed",
"just as": "just as",
"likewise": "likewise",
"meanwhile": "meanwhile",
"moreover": "moreover",
"naturally": "naturally",
"nevertheless": "nevertheless",
"next": "next",
"nonetheless": "nonetheless",
"not only": "not only",
"of course": "of course",
"on the other hand": "on the other hand",
"overall": "overall",
"owing to": "owing to",
"second": "second",
"similarly": "similarly",
"similarly to": "similarly to",
"since": "since",
"so": "so",
"soon": "soon",
"specifically": "specifically",
"subsequently": "subsequently",
"such as": "such as",
"that is to say": "that is to say",
"then": "then",
"therefore": "therefore",
"third": "third",
"thus": "thus",
"to clarify": "to clarify",
"to demonstrate": "to demonstrate",
"to illustrate": "to illustrate",
"to sum up": "to sum up",
"ultimately": "ultimately",
"undoubtedly": "undoubtedly",
"until": "until",
"what's more": "what's more",
"while": "while",
"while it is true": "while it is true",
"without a doubt": "without a doubt",
"yet": "yet"
}
85 changes: 84 additions & 1 deletion resources/lang/nl.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
{
"accordingly": "overeenkomstig",
"additionally": "daarnaast",
"admittedly": "toegegeven",
"after": "na",
"afterward": "daarna",
"all in all": "alles bij elkaar genomen",
"although": "hoewel",
"an example of this is": "een voorbeeld hiervan is",
"as a result": "als resultaat",
"as well as": "evenals",
"because": "omdat",
"before": "voordat",
"besides": "bovendien",
"but also": "maar ook",
"certainly": "zeker",
"compared to": "vergeleken met",
"consequently": "als gevolg",
"conversely": "omgekeerd",
"due to": "vanwege",
"during": "tijdens",
"even though": "zelfs als",
"eventually": "uiteindelijk",
"failed.configuration.nofollow.meta": "The page contains a nofollow meta tag, while it should not.",
"failed.configuration.nofollow.tag": "The page contains a nofollow tag, while it should not.",
"failed.configuration.noindex.meta": "The page contains a noindex meta tag, while it should not.",
Expand All @@ -9,11 +31,15 @@
"failed.content.broken_images": "The page contains broken images. These images were found: :actualValue.",
"failed.content.broken_links": "The page contains broken links. These links were found: :actualValue.",
"failed.content.length": "The content is :actualValue characters long. It should be at least :expectedValue characters long.",
"failed.content.length.parse": "We konden de inhoud van deze pagina niet analyseren, probeer het opnieuw.",
"failed.content.mixed_content": "The page contains links to insecure addresses, while it should not. These links were found :actualValue.",
"failed.content.multiple_h1": "The page contains multiple h1 tags, while it should not. These tags were found :actualValue.",
"failed.content.no_heading": "The page does not contain any h1 tag, while it should.",
"failed.content.no_title": "The page does not contain a title tag, while it should.",
"failed.content.title_length": "The page title is :actualValue characters long. It should be max :expectedValue characters long.",
"failed.content.too_long_sentence": "The page contains :actualValue sentences that are too long.",
"failed.content.transition_words_ratio_check.no_phrases_found": "De pagina bevat geen zinnen.",
"failed.content.transition_words_ratio_check.too_few_transition_words": "De pagina bevat te weinig transitiewoorden. Het zou minstens 30% moeten zijn, maar het is :actualValue%.",
"failed.meta.description": "The page does not contain a description meta tag, while it should.",
"failed.meta.no_lang": "The page does not contain a lang attribute, while it should.",
"failed.meta.open_graph_image": "The page does not contain an open graph image, while it should.",
Expand All @@ -28,5 +54,62 @@
"failed.performance.response": "The page returned a response code other than :expectedValue. The actual response code was :actualValue.",
"failed.performance.ttfb": "The page took too long to load (max :expectedValuems). The actual time was :actualValuems.",
"failed.performance.ttfb.missing_url": "We could not get the TTFB for this page.",
"failed.content.too_long_sentence": "The page contains :actualValue sentences that are too long."
"finally": "uiteindelijk",
"first": "eerst",
"for example": "bijvoorbeeld",
"for instance": "bijvoorbeeld",
"furthermore": "verder",
"granted": "toegegeven",
"however": "echter",
"in addition": "daarnaast",
"in comparison": "in vergelijking",
"in conclusion": "ter conclusie",
"in contrast": "in tegenstelling",
"in other words": "met andere woorden",
"in particular": "in het bijzonder",
"in summary": "samengevat",
"in the future": "in de toekomst",
"in the meantime": "ondertussen",
"in the past": "in het verleden",
"in this case": "in dit geval",
"indeed": "inderdaad",
"just as": "net zoals",
"likewise": "evenzo",
"meanwhile": "ondertussen",
"moreover": "bovendien",
"naturally": "natuurlijkerwijs",
"nevertheless": "desalniettemin",
"next": "volgende",
"nonetheless": "desondanks",
"not only": "niet alleen",
"of course": "natuurlijk",
"on the other hand": "aan de andere kant",
"overall": "over het geheel genomen",
"owing to": "te danken aan",
"second": "tweede",
"similarly": "op dezelfde wijze",
"similarly to": "net als",
"since": "aangezien",
"so": "dus",
"soon": "binnenkort",
"specifically": "specifiek",
"subsequently": "vervolgens",
"such as": "zoals",
"that is to say": "dat wil zeggen",
"then": "dan",
"therefore": "daarom",
"third": "derde",
"thus": "zo",
"to clarify": "om te verduidelijken",
"to demonstrate": "om te demonstreren",
"to illustrate": "ter illustratie",
"to sum up": "om samen te vatten",
"ultimately": "uiteindelijk",
"undoubtedly": "ongetwijfeld",
"until": "totdat",
"what's more": "wat meer is",
"while": "terwijl",
"while it is true": "terwijl het waar is",
"without a doubt": "zonder twijfel",
"yet": "toch"
}
Loading

0 comments on commit 1fd49dc

Please sign in to comment.