Jump to content

How to Hide or Redirect a Blog Page *without* using a password

Recommended Posts

Hi there, anyone know a way to hide a blog page...that is, make it so visitors who attempt to go to, for example, sienaandtoast.com/podcast ...are just unable to see it, or are redirected to another page? What I'm trying to do is keep individual blog posts accessible, while blocking access to [the whole bird's eye view of all the blog posts] (which they'd be able to do easily if they just go to the blog page and see all of 'em there).

Unfortunately, a redirect from the blog page just doesn't work because "Redirects only work if the page you're redirecting from has been deleted or disabled." <- per Sqsp support article and, I also don't want to require a password for this.

Has anyone successfully done something like this? Thanks in advance for any insights!

Link to comment

Wow, that's amazing, thanks! But unfortunately, this code is "too powerful," in the sense that it also redirects [direct links to individual blog posts]. I still want people to be able to access the individual blog posts. I only want to redirect people who try to access the one Blog Page.

Link to comment
6 minutes ago, ToastyT said:

Wow, that's amazing, thanks! But unfortunately, this code is "too powerful," in the sense that it also redirects [direct links to individual blog posts]. I still want people to be able to access the individual blog posts. I only want to redirect people who try to access the one Blog Page.

You can add to blog page header, or try insert Code Block > Paste above code

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Ahh! Thank you! It worked when I put the code into the "Post Blog Item Code Injection." That's pretty counter-intuitive, but fortunately, in the template I'm using (Brine,) this code loads on the blog landing page but NOT on individual blog post pages. Thank you so much again!

Link to comment
  • 4 months later...

@tuanphan I tried your code to redirect a products listing page https://www.lynnemeade.com/gift-cards/, that is part of an index page, to a product item page https://www.lynnemeade.com/gift-cards/gift-card/. The product listing page only has the single product item page.

Error message occurred as follows:
1. "Script disabled" when inserted code in code block on product listing page header. It was only editable are on that page.
2. "Waiting for cache...Waiting for www.lynnemeade.com...processing request..." for over two minutes when testing redirect after inserting code in product listing page's Gear Icon >> Advanced >> Page header Code Injection.

What else can be done to enable redirect of one existing page to another?

Thank you in advance for your help

Link to comment

If it is a whole page not just one post simply move it to the unlinked section of your site. It gets moved off the nav bar and can't be found then without knowing the url or there would have to be a link somewhere else on the site like in a summary block. I am doing just that with two summary pages, which allows me to create "two" blog pages as it were.  

my random views derrick Lee parker

Link to comment

Thank you for your suggestion @derricksrandomviews. I've started to that redirect work around.

The shop page is an index page containing our seven products pages or "sub-shops", one being gift cards. There are two ways to place the gift card product item page on the index shop page. One uses a summary block on a single page, the other a product block. Both require a custom header and footer similar to the gift card page. Without custom CSS, if that's even possible, a summary block of products lacks the product variant and buy now button and links to the product item pages. A product block may work with the link to the actual gift card item page turned off. I'm going to test both types of blocks a bit more.

Simultaneous to that effort, I'd like to continue to explore a redirect.

Link to comment
  • 1 year later...

I had this exact same issue, except that instead of "/blog" my collection parent url is "/episodes". However, I've created a custom landing page for my podcast located at "/listen" and I don't want visitors to see "/episodes" since it's not designed.

The regular URL Mapping provided by Squarespace doesn't work, since it is a collection parent.

I was finally able to work around this by injecting the following page header code into the Page Header.

 

<script>
	if(window.location.href == 'https://compelledpodcast.com/episodes' || window.location.href == 'https://compelledpodcast.com/episodes/') {

  		window.location.href = "https://compelledpodcast.com/listen";

      
 	}

</script>

 

I hope that helps someone else!

Link to comment
  • 1 month later...

Hey Everyone,

I as well have been dealing with this same problem, and wanted to share my experience in case it might help someone else in the future. I too am using one "Blog" page on my site, but am using summary blocks for my home page and other pages, and thus did not want people to access my "/blog" page, but at the same time be able to access the individual blog posts from that blog.

That being said, I did try multiple combinations of the above mentioned code from tuanphan (thank you), but ran into the same problem that ToastyT did, where although it was ridirecting to my home page correctly, it was also redirecting all of my posts as well. 

So, what finally worked for me was going to my blog page, adding a code black, and inserting the above code as HTML. Although I'm super happy that this works,  I did notice that I am actually unable to go back and edit that blog page. It just appears blank, and clicking the edit button does nothing. I did trying typing /safe the end of the URL as SS "Using Code Injection" article recommended, but then it just changed to my home page. 

I don't think this will be a problem for now, but just wanted to mention it incase anyone else has the same problem. 

I really wish Squarespace would allow for more flexibility around blog posts, such as giving the ability for Summary blocks to be able to pull in multiple blogs, being able to disable blog pages but posts, being able to only have Summary blocks on a blog page, etc)

Link to comment
10 hours ago, Horosho said:

Hey Everyone,

I as well have been dealing with this same problem, and wanted to share my experience in case it might help someone else in the future. I too am using one "Blog" page on my site, but am using summary blocks for my home page and other pages, and thus did not want people to access my "/blog" page, but at the same time be able to access the individual blog posts from that blog.

That being said, I did try multiple combinations of the above mentioned code from tuanphan (thank you), but ran into the same problem that ToastyT did, where although it was ridirecting to my home page correctly, it was also redirecting all of my posts as well. 

So, what finally worked for me was going to my blog page, adding a code black, and inserting the above code as HTML. Although I'm super happy that this works,  I did notice that I am actually unable to go back and edit that blog page. It just appears blank, and clicking the edit button does nothing. I did trying typing /safe the end of the URL as SS "Using Code Injection" article recommended, but then it just changed to my home page. 

I don't think this will be a problem for now, but just wanted to mention it incase anyone else has the same problem. 

I really wish Squarespace would allow for more flexibility around blog posts, such as giving the ability for Summary blocks to be able to pull in multiple blogs, being able to disable blog pages but posts, being able to only have Summary blocks on a blog page, etc)

Can you share link to page where you added the code? We can tweak to prevent it running in edit mode.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 4 months later...

Hi Tuanphan,

Sorry for the late response. I reviewed my own comment to remember what I did, and I'm pretty sure I added this as a code block to my blog page. However, as I am unable to edit the page, I have no idea what the code is. Although I have no intentions of editing this page now, this could be a problem in the future, so any insight would be much appreciated. 

Here is the link to the blog page where I added the code, which now redirects to my homepage:

https://www.horosho.io/blog

Please let me know if there is any further information I can provide.

Thanks!

 

Link to comment
On 5/19/2022 at 9:08 AM, Horosho said:

Hi Tuanphan,

Sorry for the late response. I reviewed my own comment to remember what I did, and I'm pretty sure I added this as a code block to my blog page. However, as I am unable to edit the page, I have no idea what the code is. Although I have no intentions of editing this page now, this could be a problem in the future, so any insight would be much appreciated. 

Here is the link to the blog page where I added the code, which now redirects to my homepage:

https://www.horosho.io/blog

Please let me know if there is any further information I can provide.

Thanks!

 

To disable code on edit mode, just access this link

https://eagle-owl-xsma.squarespace.com/config/safe

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Hi Tuanphan,

Thank you, that worked! So it turns out I did add the following code to the blog page, which indeed worked:
 

<script>
  window.location.href = "http://horosho.io";
</script>

Seeing as I am able to edit this page while in safe mode, I think I'll be good going forward. Thank you again for your help with this.

Link to comment

Create an account or sign in to comment

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

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.