Robert Zelník Posted June 11, 2012 Share Posted June 11, 2012 I would like to set a custom default/starting page inside the page hierarchy instead of the root page. Is it possible, or should I create a redirect from the home page? Could the home page be inside a second level of the page tree? Link to comment Share on other sites More sharing options...
diogo Posted June 11, 2012 Share Posted June 11, 2012 You can also put this on your homepage template: <?php $page = $pages->get(123); // replace by the page you want to replace the homepage with include("./{$page->template}.php"); 5 Link to comment Share on other sites More sharing options...
ryan Posted June 11, 2012 Share Posted June 11, 2012 You could also do this in your homepage template: echo $pages->get('/path/to/page/')->render(); 6 1 Link to comment Share on other sites More sharing options...
David Noble Posted August 13, 2013 Share Posted August 13, 2013 It took me a little while to work out exactly what this meant. Given that this is talking about moving the default homepage from the top of the tree it wasn't immediately clear to me which homepage template diogo and Ryan were talking about above. So just to be clear, my understanding is that what you would do is create a template for the page at the top of the tree - which need contain nothing more than Ryan's code above. You would then create a new "home page" template for the page you actually want to be the home page. Perfectly logical when you think about it - but I'm a bit slow 1 Link to comment Share on other sites More sharing options...
ryan Posted August 14, 2013 Share Posted August 14, 2013 I think it's best though just to keep it simple and use the template file home.php as your homepage template, and keep that on your root page. 1 Link to comment Share on other sites More sharing options...
webweaver Posted September 7, 2013 Share Posted September 7, 2013 Coming from ModX, I like the idea of having the default "home" page be in the heirarchy with the other pages instead of looking like the parent. I think I will go this route and rename the root parent to "Web" like in ModX (Or maybe "Your Website" or "Root"). I think this method will also make it easier for clients to understand. Also, it makes things a little bit easier when it comes to navigation not having to specifically tailor the navigation to include the root page. My question is, how do you think this will affect SEO? Is it better just to set the index file to a different name in .htaccess? Link to comment Share on other sites More sharing options...
ryan Posted September 8, 2013 Share Posted September 8, 2013 Coming from ModX, I like the idea of having the default "home" page be in the heirarchy with the other pages instead of looking like the parent. I think I will go this route and rename the root parent to "Web" like in ModX (Or maybe "Your Website" or "Root"). I think this method will also make it easier for clients to understand. Also, it makes things a little bit easier when it comes to navigation not having to specifically tailor the navigation to include the root page. I'm not sure I agree that it's a good idea or that it would make more sense to clients. I think what makes the most sense to clients is when structure represents reality, both front-end and back-end. In that context, the homepage is the root page, the common ancestor of all others. The more you abstract those things, the less sense it makes to clients, at least in my experience. As a result, I encourage people to use the homepage as the homepage rather than trying to abstract it to somewhere else. My question is, how do you think this will affect SEO? Is it better just to set the index file to a different name in .htaccess? If you are going to abstract it, then it depends how you do it. I would avoid handling it from the htaccess and instead edit your /site/templates/home.php to load and render the other page that you want to represent the homepage. $otherPage = $pages->get('/path/to/your/abstracted/homepage/'); $otherPage->you_be_homepage = true; echo $otherPage->render(); In the page represented by that path above, you'd want to have it throw a 404 (via it's template) when you_be_homepage is not set, just by throwing this at the top. if(!$page->you_be_homepage) throw new Wire404Exception(); or make it redirect to the root page: $session->redirect('/'); Using this strategy, you shouldn't have to consider any effects on SEO as the abstraction will be invisible from the outside. 4 Link to comment Share on other sites More sharing options...
webweaver Posted September 9, 2013 Share Posted September 9, 2013 @Ryan.. Let's say I have a site with the following navigation: Home | About | Services | Contact . I don't view "Home" as the ancestor in this navigation, instead I see it as the "Home page" on the same level as the "About Us page", etc. So if one of the pages had sub navigation, the heirarchy would be like this: Home About ServicesWeb Design Web Hosting Contact If "Home" were the root then it would look like this: HomeAbout ServicesWeb Design Web Hosting Contact To me the former way represents the reality of the website structure. The latter way says that "About", "Services", and "Contact" are sub navigation to "Home" which may represent better the structure of the default PW backend, but not the front end website. I hope you don't think I'm arguing about this Just trying to clarify my thought process. Thank you for the explanation regarding SEO - very helpful. *quick side note: I have my profile updated to receive email notification when there is a reply in a thread I'm involved in, but I'm not receiving any notifications Link to comment Share on other sites More sharing options...
arjen Posted September 9, 2013 Share Posted September 9, 2013 So you would have http://domain.com/home as a page too? Especially from a SEO POV/structural thinking I would argue that having a homepage at "/" is the way to go. It is the parent/grandparent of all your pages. This made a lot of sense from when I started using ProcessWire. Other cms'es tend to let you create a homepage which is whatever page. It may seem rigid, but you get a lot of freedom when settling with one root. In a multisite I could see other roots as well, but when dealing with a one-site hierarchy I love the way PW dictates the overal structure, but within that "/" you can do anything you want. http://domain.com/ http://domain.com/about-us/ http://domain.com/about-us/history/ Seems very clear, readable and supernice to me 1 Link to comment Share on other sites More sharing options...
webweaver Posted September 9, 2013 Share Posted September 9, 2013 @arjen.. I see what you are saying. But that doesn't match the actual horizontal navigation that is on the website. Yes, I would have http://domain.com/home as a page too. When I build a basic static website, I have an index.html file (home page) that is on the same level in the hierarchy as say aboutus.html, and contact.html. Aboutus.html and contact.html are not sub navigation - they are on the same level as Home. Here is a graphic to illustrate my point: Not to belabor the point, but the first way makes more sense to me where the root page in PW admin would be considered a "container" of all the pages on the website - including the home page. I doesn't make sense to treat the Home page as a container to other pages that are not sub pages, but instead are on the same level (at least as far as the navigation on the actual website is displaying it). In my view, it would be more intuitive for the "Home" page in PW to be named something that represents it as a container for the site (ex: "Web"). Another example.. The folder structure on my server has "public_html" as the root folder. I would not post on my front end website a page called "Public HTML", it is not a page, only a containing folder. The index.html (home page) rests inside the public_html folder and is on the same hierarchal level as other pages in the primary navigation. I know PW does not force it's default on anyone (great thing about PW) and it has been laid out very clearly how to take the other route. But I guess it's just a little nitpicky thing I'd like to see changed in the default PW admin, so am making my case Link to comment Share on other sites More sharing options...
apeisa Posted September 9, 2013 Share Posted September 9, 2013 I think that is pretty much visuals and design (ie. sometimes "home" is not on main menu, but as a clickable logo above the menu). Mapping pagetree with url structure makes a lot of sense in my opinion. Not a big deal though Link to comment Share on other sites More sharing options...
arjen Posted September 10, 2013 Share Posted September 10, 2013 @webweaver, I get your point from a visual POV. Some people like the homepage to have subpages too The index.html always bugged me since the early days of Frontpage since I didn't feel right to have a domain.com/ and a domain.com/index.html. Link to comment Share on other sites More sharing options...
tires Posted June 11, 2018 Share Posted June 11, 2018 Solved this problem for one of my sites today with this three steps: Changed the page name of the new homepage into "home" (because of the navigation) Inserted this code into the old home.php template file: echo $pages->get(1234)->render(); // "1234" is the page id of the new home page Inserted this code into the config.php: $config->guestUserPageID = 1234; // "1234" is the page id of the new home page It works perfect. Even with segmets if the old homepage template has switched on "allow URL segments". Just want to share this one ... 1 Link to comment Share on other sites More sharing options...
Jaggerso30 Posted December 24, 2018 Share Posted December 24, 2018 (edited) Even I am working on my Child Care Website Design and learning everything step by step. Was just looking for the best practices to update the home page and this post has helped me a lot. In fact other threads have also been useful for me to create the contact page and landing page. Keep sharing your valuable answers! Edited December 24, 2018 by Macrura Link removed 2 Link to comment Share on other sites More sharing options...
neophron Posted May 3, 2019 Share Posted May 3, 2019 Hi, for a new website project, the client wants a horizontal menu and some of the end items are parent pages. The problem ist, that the »home«-page item also should have subpages as the other items. If I have two »home«-pages with the same content, this could be problematic, due to the double content (solution echo $pages->get(1234)->render();). If I create a redirect from "/" to "/fakehome" and I leave in the sitemap.xml the "/", how google would show and list the website? My goal is, to create a search result like e.g. Processwire in the attached screenshot. Link to comment Share on other sites More sharing options...
wbmnfktr Posted May 3, 2019 Share Posted May 3, 2019 Just don't create a fake homepage. Build a custom menu that shows whatever pages you want to appear there below the homepage item. Menu Builder is the perfect module for this. 2 Link to comment Share on other sites More sharing options...
neophron Posted May 3, 2019 Share Posted May 3, 2019 2 hours ago, wbmnfktr said: Just don't create a fake homepage. Build a custom menu that shows whatever pages you want to appear there below the homepage item. Menu Builder is the perfect module for this. Thanks for the tip. I never tried this module, now the time as come ? Link to comment Share on other sites More sharing options...
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