Jump to content

quickjeff
 Share

Recommended Posts

Hi Guys, 

I have a question in regards to SEO and Processwire. 

We are in process of migrating a site with about 600+ pages that resides on a bespoke CMS. 

About 200 of these pages are keyword targeted pages.  They are content heavy with friendly URLs.  However, these pages reside in the CMS under a section called other.  Since the CMS they are on is not Processwire but custom, the URLs are vanity URLS, whereas Processwire the URL would look like:

/other/page-title 

Therefore, I have setup a vanity url field and used a similar approach to what Soma did here:

https://processwire.com/talk/topic/3057-how-to-keep-pages-organized-when-managing-lots-of-landing-pages/

But for my solution I do show the shorter vanity url, in which some users are displaying the redirect. 

My question is this:  If I show the shorter URL, is Google going to crawl the page as:

/other/page-title 

or

/page-title

Any help is appreciated. 

Thanks guys!

Link to comment
Share on other sites

it depends on if you are rendering the page off the root or redirecting; for a landing page you may as well render it using the URL segments technique;

and you can manipulate your canonical URL to show the off-root URL

Link to comment
Share on other sites

@Macrura - To be exact, I am using the approach Soma used here:

https://processwire.com/talk/topic/3057-how-to-keep-pages-organized-when-managing-lots-of-landing-pages/

I am also enabled URL segments on the home page. 

So when the user visits the shorter url, the page displays and the url stays short. Basically what Soma did here:

if($found->id){
    echo $found->render();
    exit(0);
}
Link to comment
Share on other sites

My question is this:  If I show the shorter URL, is Google going to crawl the page as:

/other/page-title 

or

/page-title

as long as the page URL is /page-title they should crawl that;

you could also use a hook to make those pages live off the root as is explained in the CMS critic case study.

that would take care of the URLs, because then the system would always rewrite those landing page URLS to the root versions

i use this for landing pages:

wire()->addHookBefore('Page::path', function($event) {
  $page = $event->object;

  if($page->template == 'landing-page') {
    // ensure that pages with template 'landing-page' live off the root
    $event->replace = true;
    $event->return = "/$page->name/";
  }

});

in the landing page itself i put this:

// if someone tries to access this page at it's real location in the page tree, redirect to the fake URL:
if(!$input->urlSegment1) {
	$session->redirect($page->url);
}
Link to comment
Share on other sites

@Macrura, I figured it out! 

After rereading what you said about the CMSCritic Case Study, I had go back and and adjust the code of the home page with:

if(strlen($input->urlSegment2)) {
  // we only accept 1 URL segment here, so 404 if there are any more
  throw new Wire404Exception();

} else if(strlen($input->urlSegment1)) {
  // render the landing page named in urlSegment1 
  $name = $sanitizer->pageName($input->urlSegment1);
  $post = $pages->get("/landing-pages/")->child("name=$name");
  
  if($post->id) echo $post->render();
    else throw new Wire404Exception();
  

} else {
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...