-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ENHANCEMENT] - Social links/parameters should support the full URL #350
Comments
@mattstratton I'm gonna sit down and look at this now. So i converted the LinkedIn block to this:
I couldn't find any existing helper function that was more graceful than this. I could try to write one that can be reused for all the social links, do you think this is the right path? |
I think that would work! I feel like I did this similar type thing in another Hugo project but I can't remember exactly where I did it, so if you want to pop in a PR with this for the social links, I'd review it quickly and get it released! |
@mattstratton Should I make it as a shortcode? |
Shortcode won't work; you can only use shortcodes in markdown/content files, not templates. I think the issue is that we display social links in a couple templates, and since we are writing in Go template but not Go proper, we can't really make functions. Etc. |
@mattstratton OK so should I just do the above kind of expansion for every social param, or should I only do it for LinkedIn for now where its needed to link to a company page? Maybe other ones like youtube and google have the same problem and I just haven't run into it yet. |
Exactly - I wanted to do it for all of the parameters mostly because that makes it easier for folks to not have to remember if that parameter is the full URL or just the user/org name! |
@mattstratton Is there any reason to keep the google plus stuff in there? Clicking the link in the sample page shows this: |
Yeah, it's probably long since gone enough that we can remove it :) |
@mattstratton I was about to dive into changing all of these in all the other places where we generate URLs but I also saw this in REFERENCE.md "TODO: Remove these parameters from exampleSite, but also add one for the the shortname of the host for linking to host page (optional)" Do you want me to remove/cleanup anything in the other pages while I'm at it? |
Ugh I have to clean that up. Basically the idea is that the Authors support should go away and be replaced with the idea of Host pages, but I don't remember enough of what I meant when I wrote that TODO 😂 |
Basically right now you can ignore any social urls generated from the So basically just the site header, the single episode template, and the guest/host single template (maybe the guest/host list templates too? I forget) |
OK, a topic for another time. So other partials I need to change to match: footer_scripts: parse out the twitter handle if the social twitter variable is a full URL And the single episode layout page as well. Anything else you can think of that I missed? |
Ah ok guest and hosts I missed I'll do those also. |
I think these are the files: layouts/guest/list.html I do wonder if there’s a way we could write a partial for anywhere a list of a person’s social links display (wouldn’t work for guest/list.html or partials/header.html) and pass the reference to it? I’m rusty on how the dot |
I think a partial might work if you pass the variables to it https://gohugo.io/templates/partials/#variable-scoping But I don't remember if you can call the same partial more than once in a template. I imagine you can but haven't tried.
|
Thanks for this, by the way! |
Yeah I have it working, it took having to pass a dict into the partial so i can pass multiple parameters as shown here: https://flaviocopes.com/hugo-partial-multiple-parameters/
|
@mattstratton why is facebook the only one in this list that has class = nav-item? https://github.com/mattstratton/castanet/blob/main/layouts/partials/header.html#L35
|
Because I suck at coding? Hmm. It's possible it's not required. It's also possible that changing it would break something weird. I'm on my phone today so I can't test; you can take it out of the FB one and see if it changes anything if you'd like - or keep it in and let's file a follow up issue for me to investigate that. |
OK I am not a front end guy so the nuances of this CSS stuff escapes me. Seems fine without it though. |
Okie dokie, its in, let me know if you find any issues in your testing or see something I missed. |
For several reasons, including consistency (or social networks changing their URL patterns, etc) all the social links (for both guest/host as well as the params for the site) should support the existing pattern of "name of profile" but also the full URL to the profile as valid input.
We can do that thing where if the value starts with "http" then pass it direct, and if not, transform it.
Connected to #348
The text was updated successfully, but these errors were encountered: