Master Page not displaying correctly for one page

Issues related to previewing and publishing your web site.
Post Reply
Birdman24
 
 
Posts: 8
Joined: Wed Jan 18, 2023 9:43 pm

Master Page not displaying correctly for one page

Post by Birdman24 »

I am using master pages for a site I am working on and the all of the pages using master pages are working correctly. However, i recently added a new page (also using the master page) to handle 404 page not found errors. During testing, the page displayed correctly if I entered a URL for a page that doesn't exist. However, if tried to open a PDF in a new window, the background for the header, footer and content would not be displayed and the CSS Menu with navigation buttons would not display but instead be a list type navigation.

In further testing, I determined that if I entered a URL for a PDF file that should be located in the root directory, the error page worked perfectly. However, if I entered a URL for a PDF file located in a subdirectory (as site is designed) the error page does not display correctly.

As an example:

1) The error page works fine for a web page not found: https://islandcrownedb.com/nosuchurl.html
2) Likewise the error page works fine for a PDF not found in root directory: https://islandcrownedb.com/nosuchfile.pdf
3) The error page does not work when a PDF is to located in a sub-directory (documents): https://islandcrownedb.com/documents/nosuchfile.pdf
User avatar
crispy68
 
 
Posts: 3038
Joined: Thu Oct 23, 2014 12:43 am
Location: Acworth, GA
Contact:

Re: Master Page not displaying correctly for one page

Post by crispy68 »

I think you will need to add direct paths to your images in the code for it to work. Since you are using relative paths it is looking for the image in "images/your image" when it should be "../images/your image".

I did see a suggestion on stackoverflow to try (don't know if it works) but to add:

<base href="https://mywebsite.com">

to the <head> tag of the error page to make all relative urls resolve to mywebsite.com.
Birdman24
 
 
Posts: 8
Joined: Wed Jan 18, 2023 9:43 pm

Re: Master Page not displaying correctly for one page

Post by Birdman24 »

crispy68 - Thanks for your suggestion but I have a few questions.

1) Since I inserted the image to be used on the ContentPlaceHolder of the Master Page by simply identifying where the image is located on my computer and WYSIWYG Web Builder puts the image for the site in the images folder and thus generates the code "images/your image", I am not sure how I change anything to look in "..images/your image".
2) Even if I can resolve the image problem for the error page in question, the Header and Footer of the master page does not use images, but instead the Background Mode for both is SOLID with different colors for each.
3) Also, the navigation bar that on the header is broken if the reference to the PDF file is in a subdirectory.

It looks like something else may also be in play here.
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Master Page not displaying correctly for one page

Post by Pablo »

When using master pages, it is important that master page is in the same folder as the page that is using it.
The master page structure is the same for all pages so if it's in a different folder then relative paths will not be valid. Relative paths are only valid in the same folder.

Note that this is also documented in the help.

If you need further assistance then please share a DEMO project so I can see all your settings.
Birdman24
 
 
Posts: 8
Joined: Wed Jan 18, 2023 9:43 pm

Re: Master Page not displaying correctly for one page

Post by Birdman24 »

Pablo - Thanks for your response. Just to confirm I understand the issue correctly, assuming that I have Page1.html, MasterPage.html, Error404.html all in the root directory along with the site's other pages,. Page1.html attempts to open a pdf file located in a subdirectory to display in a new tab, the Error404.html will not display correctly because the pdf file is located in a subdirectory. Thanks for confirming.
User avatar
Pablo
 
Posts: 23401
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Master Page not displaying correctly for one page

Post by Pablo »

I was referring to the master page.
The error page behavior depends on the server configuration. This is unrelated to WWB.
Post Reply