Skip to content

Commit

Permalink
move lang file.
Browse files Browse the repository at this point in the history
  • Loading branch information
rdlabo committed May 24, 2018
1 parent 23e7441 commit d0bec8d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 20 deletions.
22 changes: 2 additions & 20 deletions lighthouse-core/audits/seo/link-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,7 @@

const Audit = require('../audit');
const URL = require('../../lib/url-shim');
const BLOCKLIST = new Set([
// English
'click here',
'click this',
'go',
'here',
'this',
'start',
'right here',
'more',
'learn more',
// Japanese
'ここをクリック',
'こちらをクリック',
'リンク',
'続きを読む',
'続く',
'全文表示',
]);
const BlockList = require('../../config/lang-link-text-config');

class LinkText extends Audit {
/**
Expand Down Expand Up @@ -56,7 +38,7 @@ class LinkText extends Audit {
return false;
}

return BLOCKLIST.has(link.text.trim().toLowerCase());
return BlockList.has(link.text.trim().toLowerCase());
});

const headings = [
Expand Down
13 changes: 13 additions & 0 deletions lighthouse-core/config/lang-link-text-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @license Copyright 2017 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

const linkTextEn = require('./lang/en/link-text-en');
const linkTextJa = require('./lang/ja/link-text-ja');

module.exports = new Set(linkTextEn.concat(
linkTextJa
));
18 changes: 18 additions & 0 deletions lighthouse-core/config/lang/en/link-text-en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @license Copyright 2017 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

module.exports = [
'click here',
'click this',
'go',
'here',
'this',
'start',
'right here',
'more',
'learn more',
];
18 changes: 18 additions & 0 deletions lighthouse-core/config/lang/ja/link-text-ja.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @license Copyright 2017 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';

module.exports = [
'ここ',
'こちら',
'ここをクリック',
'こちらをクリック',
'リンク',
'続く',
'続きを読む',
'もっと読む',
'全文表示',
];

0 comments on commit d0bec8d

Please sign in to comment.