Archived topic
Front Page Hero
25 replies · Started by Puneet on May 10, 2022
Hi
Below is the screenshot of a page hero from a Generateblocks video:-
https://snipboard.io/UgYq5P.jpg
Let's say I want to use that below header and above posts on my front page, and when a user clicks on the button, it takes them to the posts below. I can do the rest but don't know how to go about the button action part. I know how to add a URL but don't understand how to take the user on a part below or above on the same page.
My front page is: https://manoftech.com/
Regards,
Puneet
Hi there,
select the Container Block that hast the Latest Posts title inside. And go to the Advanced panel where you will see a HTML Anchor field.
In that field add unique name for that section on that page eg. latest-posts
Now in your button URL you can add your HTML Anchor proceeded by a # - so for my example it would be: #latest-posts
Hi David,
Thanks, I understand the idea now, but in my case, I am using the generatepress latest posts display and not a static main page. I am going to place the hero using a hook above posts. If I inspect the blocks, this is the div I see "generate-columns-container," but that will be the same for archive pages as well. I have used Generateblocks to design the front page and archive posts. Should I use the above div or assign an HTML anchor to the designed post block? In that case, do I also need to create different elements for the main and archive pages?
Regards,
Puneet
HTML Anchors and IDs are the same thing, so if you inspect the HTML you will see this before the generate-columns-container:
<main class="site-main" id="main">
So you can use #main
It doesn't matter that that ID appears on every page. If you're URL is simply #main it ill jump to that ID on the current page
Thanks a ton David. Learned a new thing today. Like always, I appreciate the prompt help Generatepress team provides.
Regards,
Puneet
Glad we can be of help!
Hi,
Can I in some way make the scroll down after clicking the button smoother? At this point, it abruptly goes to the intended element which is posts on the main page.
Regards,
Puneet
In Customizer > General enable the Smooth Scroll option.
Then select the Button and in Advanced > Additional CSS Class(es) add smooth-scroll
Thank you, David,
Regards,
Puneet
You're welcome
Hi,
Tried the smooth scroll today. The problem is that smooth scroll is not getting enabled in the Generatepress customizer. Every time I tick it, publish it, get out, and it's unticked when I return.
Hi,
I was able to activate smooth scroll after changing the Dynamic CSS print method to external. Changed it back to inline and smooth scroll still remained activated. Thanks,
Is it working now ?
Hi David,
Thanks for responding. It's working now; the only problem is that if I touch the start now button on mobile, it still abruptly goes to the target. If I press a little hard, bringing the hover into play, then it scrolls smoothly.
Regards,
Puneet
Sorry forgot to mention the page link:-
The front page is https://manoftech.com/