Skip to content
This repository was archived by the owner on Dec 13, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/xmlsitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,12 @@ private static function addPagesToSitemap( Pages $pages, string &$r, ?string $la
if ( $langcode == '--' ) {
static::addComment( $r, '(--) "' . $p->title() . '"' );
} else {
static::addComment( $r, '(' . $langcode . ') "' . $p->content( $langcode )-> title() . '"' );

// skip becaue no translation available
if ( static::$optionNOTRA == true && ! $p->translation( $langcode )->exists() ) {
// skip because no translation available
if ( static::$optionNOTRA == true && is_null($p->translation($langcode)) ) {
static::addComment( $r, 'excluding because translation not available' );
continue;
}
static::addComment( $r, '(' . $langcode . ') "' . $p->content( $langcode )-> title() . '"' );
}
}//end if

Expand Down Expand Up @@ -469,7 +468,7 @@ private static function addPagesToSitemap( Pages $pages, string &$r, ?string $la
$r .= ' <xhtml:link rel="alternate" hreflang="x-default" href="' . $p->urlForLanguage( kirby()->language()->code() ) . '" />' . "\n";
// localized languages: <xhtml:link rel="alternate" hreflang="en" href="http://www.example.com/"/>
foreach ( kirby()->languages() as $l ) {
if ( static::$optionNOTRA == true && ! $p->translation( $l->code() )->exists() ) {
if ( static::$optionNOTRA == true && is_null( $p->translation( $l->code() ) ) ) {
$r .= ' <!-- no translation for hreflang="' . $l->code() . '" -->' . "\n";
} else {
// Note: Contort PHP locale to hreflang-required form
Expand Down