diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..cacaeb28 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Changed +- Add logic to set the node's link from the element when isPermaLink="true" and no link is present. (#12) + + +### Fixed + diff --git a/src/FeedIo/Rule/PublicId.php b/src/FeedIo/Rule/PublicId.php index 6ac39905..089c1ec1 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' + && $node->getLink() === null) { + $node->setLink($element->nodeValue); + } } /**