Skip to content

Commit

Permalink
Merge branch 'development' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
StJudeWasHere committed Oct 24, 2024
2 parents d7ee311 + b282375 commit bf55635
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The issues on your website are organized into three categories based on their le

A hosted version of SEOnaut is available at [seonaut.org](https://seonaut.org).

![seonaut](https://github.com/user-attachments/assets/6184b418-bd54-4456-9266-fcfd4ce5726d)

## Technology

SEOnaut is a web based application built with the Go programming language and a MySQL database for its data storage. On the frontend side, the user interface is designed with simplicity in mind, using custom CSS and minimal vanilla Javascript. To make the dashboard interactive, the application utilizes Apache ECharts.
Expand Down
8 changes: 8 additions & 0 deletions internal/issues/page/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ func NewInvalidLangReporter() *models.PageIssueReporter {
return false
}

if pageReport.StatusCode >= 300 && pageReport.StatusCode < 400 {
return false
}

if pageReport.Lang == "" {
return false
}
Expand Down Expand Up @@ -56,6 +60,10 @@ func NewMissingLangReporter() *models.PageIssueReporter {
return false
}

if pageReport.StatusCode >= 300 && pageReport.StatusCode < 400 {
return false
}

return pageReport.Lang == ""
}

Expand Down
43 changes: 43 additions & 0 deletions internal/issues/page/language_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@ func TestInvalidLangIssues(t *testing.T) {
}
}

// Test the InvalidLang reporter with a PageReport that has a redirect status code.
// The reporter should not report the issue.
func TestInvalidLang30xNoIssues(t *testing.T) {
pageReport := &models.PageReport{
Crawled: true,
MediaType: "text/html",
Lang: "InvalidLangCode",
StatusCode: 301,
}

reporter := page.NewInvalidLangReporter()
if reporter.ErrorType != errors.ErrorInvalidLanguage {
t.Errorf("TestNoIssues: error type is not correct")
}

reportsIssue := reporter.Callback(pageReport, &html.Node{}, &http.Header{})

if reportsIssue == true {
t.Errorf("TestInvalidLangIssues: reportsIssue should be false")
}
}

// Test the MissingLang reporter with a PageReport that has a language attribute.
// The reporter should not report the issue.
func TestMissingLangNoIssues(t *testing.T) {
Expand All @@ -74,6 +96,27 @@ func TestMissingLangNoIssues(t *testing.T) {
}
}

// Test the MissingLang reporter with a PageReport that has a redirect status code.
// The reporter should not report the issue.
func TestMissingLang30xNoIssues(t *testing.T) {
pageReport := &models.PageReport{
Crawled: true,
MediaType: "text/html",
StatusCode: 301,
}

reporter := page.NewMissingLangReporter()
if reporter.ErrorType != errors.ErrorNoLang {
t.Errorf("TestNoIssues: error type is not correct")
}

reportsIssue := reporter.Callback(pageReport, &html.Node{}, &http.Header{})

if reportsIssue == true {
t.Errorf("TestMissingLangNoIssues: reportsIssue should be false")
}
}

// Test the MissingLang reporter with a PageReport that has an empty language attribute.
// The reporter should report the issue.
func TestMissingLangIssues(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion translations/translation.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ ERROR_BLOCKED: Blocked by robots.txt
ERROR_BLOCKED_DESC: Pages blocked by robots.txt won't be crawled by search engines. Keep an eye on this list to make sure important pages are not being blocked.

ERROR_ORPHAN: Orphan pages
ERROR_ORPHAN_DESC: Pages that are not linked anywhere in your site, this means no visitors can access to it and may lead to lead to crawl wastage.
ERROR_ORPHAN_DESC: Pages that are not linked anywhere in your site, this means no visitors can access to it and may lead to crawl wastage.

NO_INDEX_IN_SITEMAP: Non-indexable pages are included in the sitemap
NO_INDEX_IN_SITEMAP_DESC: Non-indexable pages should not be included in a sitemap, as this sends a mixed signal to the search engines. They can also slow down the crawling process and lead to incorrect indexing.
Expand Down

0 comments on commit bf55635

Please sign in to comment.