diff --git a/CHANGELOG.md b/CHANGELOG.md index e03d51f8..d08253c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed - +- Add logic to set the node's link from the element when isPermaLink="true" and no link is present. (#8) ### Fixed diff --git a/src/FeedIo/Rule/PublicId.php b/src/FeedIo/Rule/PublicId.php index 6ac39905..992269ae 100644 --- a/src/FeedIo/Rule/PublicId.php +++ b/src/FeedIo/Rule/PublicId.php @@ -18,6 +18,11 @@ class PublicId extends RuleAbstract public function setProperty(NodeInterface $node, \DOMElement $element): void { $node->setPublicId($element->nodeValue); + if ($element->nodeName === 'guid' + && $element->getAttribute('isPermaLink') === 'true' + && is_null($node->getLink())) { + $node->setLink($element->nodeValue); + } } /**