Skip to content

Commit

Permalink
Merge branch 'v2' into lettertwo/buffer-backed-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
lettertwo committed Sep 28, 2021
2 parents 65915e5 + 4308a0d commit 8aa9c25
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
34 changes: 34 additions & 0 deletions packages/core/integration-tests/test/html.js
Expand Up @@ -170,6 +170,40 @@ describe('html', function() {
assert(/<link rel="canonical" href="\.?\/index.html">/.test(html));
});

it('should support RSS feed links', async function() {
let b = await bundle(
path.join(__dirname, '/integration/html-feed/rss.html'),
);

assertBundles(b, [
{
name: 'rss.html',
assets: ['rss.html'],
},
{
name: 'feed.xml',
assets: ['feed.xml'],
},
]);
});

it('should support atom feed links', async function() {
let b = await bundle(
path.join(__dirname, '/integration/html-feed/atom.html'),
);

assertBundles(b, [
{
name: 'atom.html',
assets: ['atom.html'],
},
{
name: 'feed.xml',
assets: ['feed.xml'],
},
]);
});

it('should support meta tags', async function() {
let b = await bundle(
path.join(__dirname, '/integration/html-meta/index.html'),
Expand Down
@@ -0,0 +1,8 @@
<!doctype html>
<html>
<head>
<link href="feed.xml" rel="alternate" type="application/atom+xml" title="Blog RSS" />
</head>
<body>
</body>
</html>
Empty file.
@@ -0,0 +1,8 @@
<!doctype html>
<html>
<head>
<link href="feed.xml" rel="alternate" type="application/rss+xml" title="Blog RSS" />
</head>
<body>
</body>
</html>
6 changes: 5 additions & 1 deletion packages/transformers/html/src/dependencies.js
Expand Up @@ -65,6 +65,8 @@ const META = {
],
};

const FEED_TYPES = new Set(['application/rss+xml', 'application/atom+xml']);

// Options to be passed to `addDependency` for certain tags + attributes
const OPTIONS = {
a: {
Expand Down Expand Up @@ -146,7 +148,9 @@ export default function collectDependencies(

if (
tag === 'link' &&
(attrs.rel === 'canonical' || attrs.rel === 'manifest') &&
(attrs.rel === 'canonical' ||
attrs.rel === 'manifest' ||
(attrs.rel === 'alternate' && FEED_TYPES.has(attrs.type))) &&
attrs.href
) {
let href = attrs.href;
Expand Down

0 comments on commit 8aa9c25

Please sign in to comment.