Hey there. It seems like what I’m after here ought to be a pretty straightforward implementation but, while I’m close, I can’t for the life of me get this over this finish line.
I have a job board app running on a dynamic collection that I’d like to change to static. Btw, I’m happy to use a bit of javascript to achieve this.
Example: I want it to essentially behave like this in terms of pages: https://remoteok.com/
My home page displays a collection list. The collection items (jobs) are represented by expandable elements (either actual accordions or just conditionally displayed divs - I’ve tried using both to achieve this; I shifted away from the accordion element as I couldnt figure out how to control its state on load, but we’ll save that for another post). Upon clicking a job, I want to go to the collection page for that job.
Job collection page
Instead of going to a typical job listing type page, the job collection page will be essentially exactly the same as the home page (using linked sections for all) except with the expanded view of that job. To the user, it looks like they never changed pages. It just looks like the job accordion got expanded. If they click it again (“close it”), they’re taken back to the home page.
I already have my pages (home page and “mirrored” collection page) setup, but I can’t figure out how to properly link & anchor to the collection page so that the selected job is in-view after the user clicks. It just goes to the top of the page. I also don’t want a scroll-to behavior on-load. I just want the page to open in the same spot it was in. I have unique IDs on each collection item since i assumed it would be as simple as throwing an anchor link on the end of my url…no dice.
I’ve tried every which way I can think of to get an anchor to come through the link to the collection page, but not success.
If someone could point me in the right direction here, I’d greatly appreciate it!