feat: add landing page templates and registration modal
- Implemented header and hero section in _header.html.twig and _hero_art.html.twig. - Created a pre-registration modal in _reg_modal.html.twig with form fields and validation. - Added page scripts for dynamic behavior and interaction in _page_scripts.html.twig. - Developed landing page structure in landing.html.twig, integrating header, footer, and modal. - Introduced tests for landing page rendering and registry validation in LandingPageTest.php and LandingRegistryTest.php.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Shared\Controller;
|
||||
|
||||
use App\Shared\Landing\LandingRegistry;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -9,6 +10,8 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
|
||||
class SeoController extends AbstractController
|
||||
{
|
||||
public function __construct(private readonly LandingRegistry $landings) {}
|
||||
|
||||
#[Route('/robots.txt', name: 'seo_robots', methods: ['GET'])]
|
||||
public function robots(Request $request): Response
|
||||
{
|
||||
@@ -30,18 +33,30 @@ class SeoController extends AbstractController
|
||||
public function sitemap(Request $request): Response
|
||||
{
|
||||
$base = $request->getSchemeAndHttpHost();
|
||||
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"
|
||||
. '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n"
|
||||
. ' <url>' . "\n"
|
||||
. " <loc>{$base}/</loc>\n"
|
||||
. ' <changefreq>weekly</changefreq>' . "\n"
|
||||
. ' <priority>1.0</priority>' . "\n"
|
||||
. ' </url>' . "\n"
|
||||
. '</urlset>' . "\n";
|
||||
. $this->urlNode("{$base}/", 'weekly', '1.0');
|
||||
|
||||
// اسلاگها فارسیاند و باید percent-encode شوند، وگرنه XML نامعتبر است.
|
||||
foreach ($this->landings->all() as $page) {
|
||||
$xml .= $this->urlNode($base . '/' . rawurlencode($page->slug), 'monthly', '0.8');
|
||||
}
|
||||
|
||||
$xml .= '</urlset>' . "\n";
|
||||
|
||||
return new Response($xml, Response::HTTP_OK, ['Content-Type' => 'application/xml; charset=UTF-8']);
|
||||
}
|
||||
|
||||
private function urlNode(string $loc, string $changefreq, string $priority): string
|
||||
{
|
||||
return ' <url>' . "\n"
|
||||
. ' <loc>' . htmlspecialchars($loc, ENT_XML1) . '</loc>' . "\n"
|
||||
. " <changefreq>{$changefreq}</changefreq>\n"
|
||||
. " <priority>{$priority}</priority>\n"
|
||||
. ' </url>' . "\n";
|
||||
}
|
||||
|
||||
private function isStaging(Request $request): bool
|
||||
{
|
||||
$host = $request->getHost();
|
||||
|
||||
Reference in New Issue
Block a user