LoginSignup
1
0

More than 5 years have passed since last update.

SlackでQiitaのfeedがbroken linkを含んでいるのを調べた

Posted at

壊れている部分

   <content type="html">
&lt;h2&gt;
&lt;span id="minitest" class="fragment"&gt;&lt;/span&gt;&lt;a href="#minitest"&gt;&lt;i class="fa fa-link"&gt;&lt;/i&gt;&lt;/a&gt;Minitest&lt;/h2&gt;

のように href 属性が相対リンクになっていて、 Slack は https://qiita.com/#minitest として扱うため、リンク切れになっている。
(アンカーが存在しないだけなので、ページ自体は開ける)

仕様を確認

atom で検索すると atom editor が検索ノイズになるので、 atom feed で検索すると良い。
仕様を軽く確認したところ、 content の type が html や xhtml のときに相対リンクがどう扱われるべきかの記述は見つけられなかった。
HTML の base 要素に相当するようなものもなさそうだった。

Feed validator でチェック

https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fqiita.com%2Ftags%2Fruby%2Ffeed でチェックしたところ、以下のようなエラーなどだけで、相対リンクは問題なさそうだった。

This feed does not validate.

line 7, column 2: Undefined feed element: description [help]

  <description>QiitaでRubyタグが付けられた新着記事</description>
  ^
line 9, column 35: link must have an href attribute [help]

  <link>https://qiita.com/tags/ruby</link>
                                   ^
line 15, column 4: Undefined entry element: url (20 occurrences) [help]

    <url>https://qiita.com/.../items/...</url>
    ^
In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

line 9, column 8: link should not have text (all data is in attributes) [help]

  <link>https://qiita.com/tags/ruby</link>
        ^
line 28, column 0: content should not contain data-lang attribute (99 occurrences) [help]

&lt;div class="code-frame" data-lang="vim"&gt;&lt;div class="highlight"&gt;& ...
line 1184, column 0: content should not contain data-canonical-src attribute (6 occurrences) [help]

    <content type="html">&lt;p&gt;&lt;a href="https://camo.qiitausercontent. ...
line 2150, column 0: content should not contain script tag [help]

&lt;script async src="https://platform.twitter.com/widgets.js"&gt;&lt;/scrip ...
line 2333, column 0: content should not contain data-hovercard-target-type attribute (8 occurrences) [help]

「&lt;a href="/profile" class="user-mention js-hovercard" title="profile" dat ...
line 2333, column 0: content should not contain data-hovercard-target-name attribute (8 occurrences) [help]

「&lt;a href="/profile" class="user-mention js-hovercard" title="profile" dat ...

別の validator でチェック

https://rssatom.com/feedvalidator.php でチェックしたところ、エラーなしだった。

要望

見出しに対応する部分に qiita.com へのリンクがあると Slack で記事の概要 + qiita.com の概要×最初の方の見出しの数 が展開されて邪魔なので、 feed では見出しの部分のリンクは削って欲しいです。

script タグなどの validator によっては怒られる部分も出来るだけ直した方が良いのではないかと思いました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0