Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (or Document) how to get the section list from the sitemap service #333

Open
tacman opened this issue Jan 25, 2024 · 1 comment
Open
Labels

Comments

@tacman
Copy link
Contributor

tacman commented Jan 25, 2024

Description

I'd like to inject the service into a controller so I can create the sitemap list by section.

Example

In the controller:

        // @todo: inject the SiteMap service and get the sections.
        $sections = [
            '',
            'default.',
            'blog.',
            'misc.',
            'yml.'
        ];
        return $this->render('default/index.html.twig', [
            'sections' => $sections,
            'pages' => $pageRepository->findBy([], [], 30)
        ]);
    <h3>Sitemaps</h3>
    <ul>
        {% for section in sections %}
            {% set url = '/sitemap.%sxml'|format(section) %}
            <li><a href="{{ url }}">
                    {{ url }}
                </a>
            </li>
        {% endfor %}
@tacman tacman added the feature label Jan 25, 2024
@tacman
Copy link
Contributor Author

tacman commented Jan 25, 2024

I'm looking and upgrading and integrating https://github.com/miisieq/RobotsTxtBundle in order to generate a robots.txt file #330

It looks like most robots.txt file have a list of sitemap: keys, not just a single one. Is there a way to automatically generate that list from the sections?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant