quickjeff Posted August 16, 2015 Posted August 16, 2015 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!
Macrura Posted August 17, 2015 Posted August 17, 2015 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
quickjeff Posted August 17, 2015 Author Posted August 17, 2015 @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); }
Macrura Posted August 17, 2015 Posted August 17, 2015 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); }
quickjeff Posted August 17, 2015 Author Posted August 17, 2015 @Macrura, so I am trying your solution now: https://processwire.com/talk/topic/9748-pages-to-have-absolute-path/ And for some reason, I have it almost working but no page content.I get the new shorter url but a 404 message instead.
quickjeff Posted August 17, 2015 Author Posted August 17, 2015 @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 {
Macrura Posted August 17, 2015 Posted August 17, 2015 yeah - that's the other piece of the puzzle... !
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now