Tips : a Dynamic syncblock-like Navigation Bar for your document across pages!

Hi community !

Here is a little to trick (Kudo to @Aurelie_Pureur1 also for finalizing the deployement of this idea! :slight_smile: ) to create a dynamic navigation bar, using wonderful @Scott_Collier-Weir 's pack Doc Explorer. Dont be afraid, if you dont have a team plan, you can also do it by hand without any pack !

The idea is to get the list of pages of your document. Create a button to open a window with url equal to browser link (or enter manually the url of your page)

Buttons wont support a direct concatenation, so we have to use Button() function for each page

With this button, the advantage is that you can personnalize icon and color of course. With Scott pack, you can convert the icon of a page to its coda name using this formula, so that the icon of button will be the same as page (converted as emoji-like)

Set a sort order if you want to manage the order of your Navigation Bar, and then just use this formula

Then you can enjoy this by creating for exemple different kind of navigation bar according to a category you would give to your pages

Here you get avery cool (and DYNAMIC !!!) Navigation bar to set on each of your pages just using something like =NavBar_level1 and be sure this is alway kept up to date !!!

CPT2303021526-1464x487

Enjoy !


Bonus edit : track the current page with a diffrerent color :wink:

CPT2303021550-1190x406

19 Likes

@Quentin_Morel This is really great! I’ve been looking for a similar solution for awhile now! Would you be able to elaborate on the bonus edit. ( of tracking the current page with a different colour)?

Thanks@

1 Like

Not in computer now but this is easy :slight_smile:

  • create a column « isCurrentPage » in your pages table, as a checkbox
  • change the action of your button. Rather than just openwindow, use a run action with
    1 a ForEach loop applied in your table, filtered for only isCurrentPage true —> modify the row in the current value of the loop and set isCurrentPage
    to false

Something like foreach(pagetable.filter(isCurrentPage),modifyrow(currentvalue,isCurrentPage,false())

2 actually open windows
3 modify this row and set isCurrentPage to true !

Modifyrow(thisrow,isCurrentPage,true())

Then you juste need to use if() function to change the color of the button in the table → if(isCurrentPage, specific color, classic color)

Cheers !

Quentin

A wonderful contribution, as always! Thanks so much, @Quentin_Morel! You have such a knack for turning coda docs into asthetically pleasing works of art :partying_face:!

3 Likes

Nice. I did something similar here. How to Create Cool Nav Buttons · Navigation Buttons (coda.io)

Nice! Reminded me of the quick filters (presets that would fill out the user-specific filters table) that I did a while ago:

I also believe there’s a way to make the “current page highlighted” functionality without setting the state programmatically anywhere (because your way is unreliable anyway — what if you navigate through the sidebar?) There’s a trick to get your current page with two formulas: one “almost invisible” (e.g. containing an emptycharacter.com) formula that you give a name, e.g. thisPage, and you can use its thisPage.ObjectLink() to get the current page’s URL. Then when you copy that along with your formula to other pages, you get interlinked copies of both:

5 Likes

@Quentin_Morel hmm. thanks for this! I’m still not quite following - probably my lack of coda knowledge.

Would it be possible to share your code that you had used in the demonstration and I can try to figure it out or something?

Once again, thanks for all of these!! Already implemented my navigation bar and its working great!

2 Likes

Hi @Sabrina_Wee

So this is your page table

You have to create a classic button (my BtnOpen)
Here is its code , as explained earlier. It requires the column “isSelected”

You define a column for color with this code. In my case the both colors are also parameters defined in another table, because i’m giving categories to my pages


And finally, build your concatened button. In my case i’ve set a ‘custom name’ if the name of the page is too long and I want to make it custom

image

Tell me if this is OK for you ?

But (no transition) as @Paul_Danyliuk said, the color change is quite a gadget, and this trick does not work if you navigate through sidebar. I’ll suggest to check Paul’s Embed document ! Thank you Paul for your always-improving advice, I’ll give it a try. And yes, I also used this trick to make a filter bar to easily set a control value ! :slight_smile:

And thanks @Nina_Ledid for your kindness :slight_smile:

2 Likes

What an inspiring chat, I love it! Coda community members building upon each other, making the entire community stronger for it! Thanks to both of you, @Quentin_Morel and @Paul_Danyliuk, for your wonderful insights!

As I was thinking my way through @Paul_Danyliuk’s trick of highlighting the current page, I couldn’t help but think that this is a crucial piece of information that will be useful for so many community members.

I have therefore turned @Paul_Danyliuk’s approach into a step-by-step guide, to outline how he achieves his result. Feel free to copy the doc here

7 Likes

When you go back on this post to read and apply @Paul_Danyliuk proposal, you see that @Nina_Ledid did the job and summarize it :slight_smile:

Ahah this is AWESOME ! A whole new level and lot of added value to this humble post !

2 Likes

Hey @Quentin_Morel ,
Are you going to publish a demo doc too?
Greetings, Joost

Yes, I would like to, I’m now implementing @Paul_Danyliuk / @Nina_Ledid current page tracker, and would like to make a whole template, with both Doc Explorer Pack and Manual implementation !

1 Like

Looking forward to seeing your sample doc!

2 Likes

One more thing in case you missed it. There’s no need for the ForEach there — you can ModifyRows at multiple rows. You only need to individually modify rows if you need to make different modification (e.g. something based on each row separately, e.g. increase some count by 1). If you just want to set the same value on multiple rows you can:

MyTable.Filter(
  CurrentValue.[Is selected] != true
).ModifyRows(
  MyTable.[IsSelected], true
)

Thanks Paul
I honestly did not know we could bulk modify rows like this ! Thanks !

Hey @Quentin_Morel is this still working for you? I have a smilar thing set up that has been working and today I noticed all my buttons that are concatenated are now grayed out and I cannot click them. Wondering if it’s just my doc or if Coda changed something that is throwing this trick off.

No, it works still fine for me ! :face_with_monocle:

Thanks for that confirmation. It’s really odd. In my primary document where I implemented something very similar to what you did, I’ve had what I call tiny buttons on some tables for months now maybe even a year and they work wonderfully. Now, my navigation bar full of tiny buttons is still working fine, but in my table where I employ the same technique, those buttons are now all disabled where last week they were not. So something on the backend changed which is affecting concatenating buttons in some cases but not in others. Very strange.

Well, further investigation shows that the tiny buttons work in a table view but in my card view that I’ve had now for a couple of years, the tiny buttons are being disabled. So…something changed on Coda’s side. If anyone else is concatenating buttons and using them in this manner and they stopped working test and see if changing to table view from card view enables the buttons again.

Would you mind sharing one of your doc for me to have a look ? Don’t think I can figure this out but…?