C
C#•3y ago
TheCultOfRa

Index NavLink not working in NavMenu

I have two pages, Index and Register My navbar's SkullDugDungeon text should redirect to Index/Home While the Register NavLink works, the former does not.
30 Replies
TheCultOfRa
TheCultOfRaOP•3y ago
if any other files are needed, lemme know
ZacharyPatten
ZacharyPatten•3y ago
well yes you shared some files, but it still isn't all the files, and sharing the files in that format isn't very helpful we can't take your files and run it at this point since you appear to be fine making the code public, why not just make a GitHub repo?
TheCultOfRa
TheCultOfRaOP•3y ago
I think I had some secrets in dev or something checking
ZacharyPatten
ZacharyPatten•3y ago
if you had secrets in your code at one time you need to make sure you scrub your git repo you should never put secrets in the source code they will be accessible in the git history
TheCultOfRa
TheCultOfRaOP•3y ago
yeah I know; ive not uploaded to a repo yet and just checked this project does not have any uploading in a sec is there a way for me to push only one project to a repo instead of a whole solution?
ZacharyPatten
ZacharyPatten•3y ago
yeah sure are you new to git? git is a vital skill every developer needs to know if you aren't very familiar with git yet you need to learn
TheCultOfRa
TheCultOfRaOP•3y ago
uh kinda? I don't use it a huge amount I just need to run the cmd line options im guessing?
ZacharyPatten
ZacharyPatten•3y ago
there are many git interfaces
TheCultOfRa
TheCultOfRaOP•3y ago
I'm using VS
ZacharyPatten
ZacharyPatten•3y ago
but yes many developers prefer the comamnd line if you don't want to upload the entire solution to GitHub then I would just use the CLI (command line) can you run this command? git --version
TheCultOfRa
TheCultOfRaOP•3y ago
yeah git version 2.30.0.windows.1
ZacharyPatten
ZacharyPatten•3y ago
okay. that is not the latest version but that si fine did you already make a repo in GitHub?
TheCultOfRa
TheCultOfRaOP•3y ago
updating about to
TheCultOfRa
TheCultOfRaOP•3y ago
GitHub
GitHub - SKullDugDev/SkullDugDungeon.Web
Contribute to SKullDugDev/SkullDugDungeon.Web development by creating an account on GitHub.
ZacharyPatten
ZacharyPatten•3y ago
Will look once I have time. probably busy for next few hours at least
blinkbat
blinkbat•3y ago
where does the one with href="" take you? my instinct is to do href="/" try including the leading slash with all of your links
ZacharyPatten
ZacharyPatten•3y ago
we still can't run your code. you checked in the Web Project but not the Shared project so your code doesn't build
TheCultOfRa
TheCultOfRaOP•3y ago
wait what? that should be the whole project oh you need the shared project too gotcha hold on
ZacharyPatten
ZacharyPatten•3y ago
it is but you reference another project
TheCultOfRa
TheCultOfRaOP•3y ago
hmmmm what's the easiest way to combine these dammit can I just push the other project to the same repo? would that work? like meaning would that make it build for yall no where it just doesn't do anything
blinkbat
blinkbat•3y ago
did you try adding /?
TheCultOfRa
TheCultOfRaOP•3y ago
yeah, I had tried that already and knew it worked; I was mainly asking why doing it like the documentation/boilerplate wasn't
TheCultOfRa
TheCultOfRaOP•3y ago
@ZacharyPatten @blinkbat sorry for the delay, I believe it should be buildable now with both projects in the repo including the sln file https://github.com/SKullDugDev/SkullDugDungeon.Web
GitHub
GitHub - SKullDugDev/SkullDugDungeon.Web
Contribute to SKullDugDev/SkullDugDungeon.Web development by creating an account on GitHub.
TheCultOfRa
TheCultOfRaOP•3y ago
I am still unable to determine why it doesn't work without the / when the doc doesn't include it in fact, in the Blazor WASM boiler plate, the nav even has a non nav-link <a> that also has no href <a class="navbar-brand" href="">BlazorApp1</a> in addition to
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
like I know I can use the / but I want to understand what's happening that's making it required this also makes it less clear why the href is empty:
If the a element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents.

If the a element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element's contents.
If the a element has an href attribute, then it represents a hyperlink (a hypertext anchor) labeled by its contents.

If the a element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element's contents.
https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element so yeah I've done as much research as I can so just lemme know if yall can help anyone? should I just repost or something?
Godspeed
Godspeed•3y ago
So to clarify, the question is why <NavLink href"" /> does not redirect to the base page? Can you try adding <base /> or <base href="/" /> to your index.html file?
TheCultOfRa
TheCultOfRaOP•3y ago
yes ohhh that probably is what I'm missing damn i saw a thing about it but didn't see where it was in the original boilerplate testing now yup! that works! thank you so much!
Godspeed
Godspeed•3y ago
No worries! Glad it worked :) That one can also be used if you want a different base route, like domain.org/something/ as base
TheCultOfRa
TheCultOfRaOP•3y ago
ah ok, that makes sense thank you again!
blinkbat
blinkbat•3y ago
i mean, href="" is bizarre to me anyway, but if it's in the docs I guess go for it
ZacharyPatten
ZacharyPatten•3y ago
nice catch. 🙂
Want results from more Discord servers?
Add your server