Skip to content

Commit

Permalink
Merge pull request #1654 from hydephp/xml-generator-bugfixes
Browse files Browse the repository at this point in the history
Fix issues with the sitemap and RSS feed generator commands
  • Loading branch information
caendesilva authored Apr 12, 2024
2 parents e81d59f + b610fd6 commit 532748b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This serves two purposes:
- for now removed features.

### Fixed
- Fixed a bug where the sitemap and RSS feed generator commands did not work when the `_site/` directory was not present in https://github.com/hydephp/develop/pull/1654
- Realtime Compiler: Fixed responsive dashboard table issue in https://github.com/hydephp/develop/pull/1595

### Security
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@

use Hyde\Hyde;
use Hyde\Framework\Features\BuildTasks\PostBuildTask;
use Hyde\Framework\Concerns\InteractsWithDirectories;
use Hyde\Framework\Features\XmlGenerators\RssFeedGenerator;

use function file_put_contents;

class GenerateRssFeed extends PostBuildTask
{
use InteractsWithDirectories;

public static string $message = 'Generating RSS feed';

protected string $path;

public function handle(): void
{
file_put_contents(
Hyde::sitePath(RssFeedGenerator::getFilename()),
RssFeedGenerator::make()
);
$this->path = Hyde::sitePath(RssFeedGenerator::getFilename());

$this->needsParentDirectory($this->path);

file_put_contents($this->path, RssFeedGenerator::make());
}

public function printFinishMessage(): void
{
$this->createdSiteFile('_site/'.RssFeedGenerator::getFilename())->withExecutionTime();
$this->createdSiteFile($this->path)->withExecutionTime();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@

use Hyde\Hyde;
use Hyde\Framework\Features\BuildTasks\PostBuildTask;
use Hyde\Framework\Concerns\InteractsWithDirectories;
use Hyde\Framework\Features\XmlGenerators\SitemapGenerator;

use function file_put_contents;

class GenerateSitemap extends PostBuildTask
{
use InteractsWithDirectories;

public static string $message = 'Generating sitemap';

protected string $path;

public function handle(): void
{
file_put_contents(
Hyde::sitePath('sitemap.xml'),
SitemapGenerator::make()
);
$this->path = Hyde::sitePath('sitemap.xml');

$this->needsParentDirectory($this->path);

file_put_contents($this->path, SitemapGenerator::make());
}

public function printFinishMessage(): void
{
$this->createdSiteFile('_site/sitemap.xml')->withExecutionTime();
$this->createdSiteFile($this->path)->withExecutionTime();
}
}

0 comments on commit 532748b

Please sign in to comment.