npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shopback-challange

v1.0.0

Published

shopback node challange

Downloads

1

Readme

使用方法
var app = require('./app');
var detectAnyTagsWithoutAttrRule = require('./PreDefinedSeoRules/DetectAnyTagsWithoutAttr');
var detectAnyTagsWithChildTagRule = require('./PreDefinedSeoRules/DetectAnyTagsWithChildTag');
var detectAnyTagsWithChildTagWithAttrAndValueRule = require('./PreDefinedSeoRules/DetectAnyTagsWithChildTagWithAttrAndValue');
var detectAnyTagsHaveNumberTagsRule = require('./PreDefinedSeoRules/DetectAnyTagsHaveNumberTags');

// 載入指定的 Html 檔案
var html = app.loadFile('test.html');
// 檢查是否有 <img> tag 沒有 alt 的屬性
app.addSeoRule(new detectAnyTagsWithoutAttrRule.DetectAnyTagsWithoutAttr('img', 'alt'));
// 檢查是否有 <a> tag 沒有 rel 的屬性
app.addSeoRule(new detectAnyTagsWithoutAttrRule.DetectAnyTagsWithoutAttr('a', 'rel'));
// 檢查是否有 <head> tag 有子 <title> tag
app.addSeoRule(new detectAnyTagsWithChildTagRule.DetectAnyTagsWithChildTag('head', 'title'));
// 檢查是否有 <head> tag 有子 <meta> tag,其有 name 的屬性與 descriptions 的值
app.addSeoRule(new detectAnyTagsWithChildTagWithAttrAndValueRule.DetectAnyTagsWithChildTagWithAttrAndValue('head', 'meta', 'name', 'descriptions'));
// 檢查是否有 <head> tag 有子 <meta> tag,其有 name 的屬性與 keywords 的值
app.addSeoRule(new detectAnyTagsWithChildTagWithAttrAndValueRule.DetectAnyTagsWithChildTagWithAttrAndValue('head', 'meta', 'name', 'keywords'));
// 檢查是否有超過 15 個 <strong> tag
app.addSeoRule(new detectAnyTagsHaveNumberTagsRule.DetectAnyTagsHaveNumberTags('strong', 15));
// 檢查是否有超過 1 個 <H1> tag
app.addSeoRule(new detectAnyTagsHaveNumberTagsRule.DetectAnyTagsHaveNumberTags('H1', 1));

// 以指定的檢查 Seo 規則解析 HTML 檔案
app.parseHtml(html);

事先定義好的 SEO 檢查規則

  1. Detect if any <img /> tag without alt attribute.
  2. Detect if any <a /> tag without rel attribute.
  3. In <head> tag i. Detect if header doesn’t have <title> tag ii. Detect if header doesn’t have <meta name="descriptions" … /> tag iii. Detect if header doesn’t have <meta name="keywords" … /> tag
  4. Detect if there’re more than 15 <strong> tag in HTML (15 is a value should be configurable by user).
  5. Detect if a HTML have more than one <H1> tag.

輸出內容

這 HTML 沒有 <img> tag 沒有 alt 屬性。
這 HTML 沒有 <a> tag 沒有 rel 屬性。
這 HTML 沒有 <head> tag 與子 `<title>` tag。
這 HTML 有指定的 <head> tag 與子 <meta> tag 有 name=descriptions 屬性與其值。
這 HTML 有指定的 <head> tag 與子 <meta> tag 有 name=keywords 屬性與其值。
這 HTML 沒有超過 15 個 <strong> tag。
這 HTML 沒有超過 1 個 <H1> tag。