• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 481faf637ba3a7c1e5f2bfef59b582ac39523de6

21 May 2025 09:11AM UTC coverage: 46.174%. First build
481faf637ba3a7c1e5f2bfef59b582ac39523de6

Pull #22291

github

web-flow
Merge pull request #22278 from Yoast/577-sanitize-and-deal-with-special-markdown-characters-before-writing-to-file

577 sanitize and deal with special markdown characters before writing to file
Pull Request #22291: Introduce the llms.txt feature

52 of 403 new or added lines in 30 files covered. (12.9%)

15586 of 33755 relevant lines covered (46.17%)

3.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/llms-txt/infrastructure/markdown-services/description-adapter.php
1
<?php
2

3
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4
namespace Yoast\WP\SEO\Llms_Txt\Infrastructure\Markdown_Services;
5

6
use Yoast\WP\SEO\Llms_Txt\Domain\Markdown\Sections\Description;
7
use Yoast\WP\SEO\Surfaces\Meta_Surface;
8

9
/**
10
 * The adapter of the description.
11
 */
12
class Description_Adapter {
13

14
        /**
15
         * Holds the meta helper surface.
16
         *
17
         * @var Meta_Surface
18
         */
19
        private $meta;
20

21
        /**
22
         * Class constructor.
23
         *
24
         * @param Meta_Surface $meta The meta surface.
25
         */
NEW
26
        public function __construct(
×
27
                Meta_Surface $meta
28
        ) {
NEW
29
                $this->meta = $meta;
×
30
        }
31

32
        /**
33
         * Gets the description.
34
         *
35
         * @return Description The description.
36
         */
NEW
37
        public function get_description(): Description {
×
NEW
38
                $meta_description = $this->meta->for_home_page()->meta_description;
×
39

40
                // In a lot of cases, the homepage's meta description falls back to the site's tagline.
41
                // But that is already used for the title section, so let's try to not have duplicate content.
NEW
42
                if ( $meta_description === \get_bloginfo( 'description' ) ) {
×
NEW
43
                        return new Description( '' );
×
44
                }
45

NEW
46
                return new Description( $meta_description );
×
47
        }
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc