From: Stephen Cameron Date: Thu, 1 Oct 2020 16:47:05 +0000 (+0200) Subject: SEO redirections, custom 404 page and improved search results formatting. WIP #3923... X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=aa2d416ac529d7884499b5d616b70998eaf25749;p=ccv-wordpress.git SEO redirections, custom 404 page and improved search results formatting. WIP #3923 @1.5 --- diff --git a/.htaccess b/.htaccess index 47084c6..f0f87bb 100644 --- a/.htaccess +++ b/.htaccess @@ -17,3 +17,40 @@ RewriteRule . /index.php [L] # Disable directory index access Options -Indexes + + + + + RewriteEngine On + + # Old website URL redirections + + # EN version (temporarily redirecting everything to FR home page since the new EN site isn't ready) + RedirectMatch 302 (?i)^/en/(.*) / + + # FR website + RedirectMatch 301 (?i)^/equipe-medicale-centre-de-chirurgie-vertebrale-montpellier.php /la-clinique/lequipe/ + RedirectMatch 301 (?i)^/clinique-du-parc-centre-de-chirugie-vertebrale-montpellier.php /la-clinique/ + RedirectMatch 301 (?i)^/anatomie-centre-de-chirurgie-vertebrale-montpellier.php / + RedirectMatch 301 (?i)^/hernie-discale-centre-de-chirurgie-vertebrale-montpellier /pathologies/hernie-discale-2/ + RedirectMatch 301 (?i)^/lombalgie-centre-de-chirurgie-vertebrale-montpellier /pathologies/discopathie-lombaire/ + RedirectMatch 301 (?i)^/canal-lombaire-etroit-centre-de-chirurgie-vertebrale-montpellier /pathologies/canal-lombaire-etroit/ + RedirectMatch 301 (?i)^/canal-cervical-etroit-centre-de-chirurgie-vertebrale-montpellier / + RedirectMatch 301 (?i)^/hernie-discale-cervicale-centre-de-chirurgie-vertebrale-montpellier /pathologies/hernie-discale-cervicale/ + RedirectMatch 301 (?i)^/scoliose-de-adolescent-centre-de-chirurgie-vertebrale-montpellier /scoliose-de-ladolescence/ + RedirectMatch 301 (?i)^/scoliose-du-vieillissement-centre-de-chirurgie-vertebrale-montpellier /scoliose-du-vieillissement/ + RedirectMatch 301 (?i)^/spondylolisthesis-centre-de-chirurgie-vertebrale-montpellier /pathologies/spondylolisthesis/ + RedirectMatch 301 (?i)^/fracture-et-entorse-colonne-vertebrale-centre-de-chirurgie-vertebrale-montpellier /tassement-vertebral/ + RedirectMatch 301 (?i)^/prothese-de-disque-montpellier-centre-de-chirurgie-vertebrale.php /competences/la-prothese-discale/ + RedirectMatch 301 (?i)^/radiologie-interventionnelle-montpellier-centre-de-chirurgie-vertebrale.php / + RedirectMatch 301 (?i)^/institut-montpellierain-du-rachis.php /la-clinique/linstitut/ + RedirectMatch 301 (?i)^/recherche-et-publication.php /la-clinique/linstitut/ + RedirectMatch 301 (?i)^/programme-de-formation.php /formation/ + RedirectMatch 301 (?i)^/espace-chirurgien.php /la-clinique/linstitut/ + RedirectMatch 301 (?i)^/formulaires-patient.php /e-diagnostic/ + RedirectMatch 301 (?i)^/formulaire-preop.php /e-diagnostic/ + RedirectMatch 301 (?i)^/formulaire-postop.php / + RedirectMatch 301 (?i)^/actualites.html /actualites/ + RedirectMatch 301 (?i)^/contactez-nous.php /contact/ + + diff --git a/wp-content/themes/CCV/resources/views/404.blade.php b/wp-content/themes/CCV/resources/views/404.blade.php index 58e68b2..702864d 100644 --- a/wp-content/themes/CCV/resources/views/404.blade.php +++ b/wp-content/themes/CCV/resources/views/404.blade.php @@ -1,13 +1,20 @@ @extends('layouts.app') @section('content') - @include('partials.page-header') - @if (! have_posts()) - @alert(['type' => 'warning']) - {{ __('Sorry, but the page you were trying to view does not exist.', 'sage') }} - @endalert + @php + // Fetch content from page named 'error-404' + // ToDo: make this more robust + $page = get_page_by_path('error-404'); + $pageID = $page->ID; + + if (function_exists('pll_get_post')) { + $pageID = pll_get_post($page->ID); + } + + if ($pageID) { + echo \Elementor\Plugin::instance()->frontend->get_builder_content_for_display($pageID); + } + @endphp - {!! get_search_form(false) !!} - @endif @endsection diff --git a/wp-content/themes/CCV/resources/views/partials/content-search.blade.php b/wp-content/themes/CCV/resources/views/partials/content-search.blade.php index 937660f..dc9e384 100644 --- a/wp-content/themes/CCV/resources/views/partials/content-search.blade.php +++ b/wp-content/themes/CCV/resources/views/partials/content-search.blade.php @@ -1,12 +1,12 @@
-

- +

+ {!! $title !!}

- @includeWhen(get_post_type() === 'post', 'partials/entry-meta') + {{--@includeWhen(get_post_type() === 'post', 'partials/entry-meta')--}}

diff --git a/wp-content/themes/CCV/resources/views/search.blade.php b/wp-content/themes/CCV/resources/views/search.blade.php index 20b1d3e..6547782 100644 --- a/wp-content/themes/CCV/resources/views/search.blade.php +++ b/wp-content/themes/CCV/resources/views/search.blade.php @@ -1,19 +1,24 @@ @extends('layouts.app') @section('content') - @include('partials.page-header') - @if (! have_posts()) - @alert(['type' => 'warning']) - {{ __('Sorry, no results were found.', 'sage') }} - @endalert +
- {!! get_search_form(false) !!} - @endif + @include('partials.page-header') - @while(have_posts()) @php(the_post()) - @include('partials.content-search') - @endwhile + @if (! have_posts()) + @alert(['type' => 'warning']) + {{ __('Sorry, no results were found.', 'sage') }} + @endalert - {!! get_the_posts_navigation() !!} + {!! get_search_form(false) !!} + @endif + + @while(have_posts()) @php(the_post()) + @include('partials.content-search') + @endwhile + + {!! get_the_posts_navigation() !!} + +
@endsection