jsonresume.org icon indicating copy to clipboard operation
jsonresume.org copied to clipboard

Possible to specify gist name?

Open duchenpaul opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe. I have multiple versions of resume, in different languages, but I see the registry is hardcoded the file name has to be resume.json, so I can only render a version of resume at one time.

Describe the solution you'd like Can we have one more parameter to specify the file name of the gist that the registry fetches from?

Describe alternatives you've considered No alternatives

Additional context

duchenpaul avatar Jun 15 '24 00:06 duchenpaul

Sounds like a good feature. I had this idea that maybe we could use a separator such that;

https://registry.jsonresume.org/thomasdavis -> loads -> resume.json https://registry.jsonresume.org/thomasdavis-en -> loads -> resume-en.json

I don't know if - will work as a separator, but would this solve your user case @duchenpaul

thomasdavis avatar Jun 15 '24 10:06 thomasdavis

Thanks for your quick fix! So still, I have to name my resume.json as resume-<x>, which I can access my resume from https://registry.jsonresume.org/thomasdavis-<x>, right?

I am happy to take this change, but this will bring another problem, which is '-' can be used as a part of Github username.

There would be a problem if a user named thomasdavis-en, it is a legal Github name, but he will face the problem here.

Suggesting to use other characters as separator, such as @, like https://registry.jsonresume.org/thomasdavis@resume-en, which will load resume-en.json

Reference: GitHub Username Policy

Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen.

duchenpaul avatar Jun 15 '24 11:06 duchenpaul

Not sure if you like this ideahttps://registry.jsonresume.org/{username}@{gist name}, I know this could bring a lot of change to the code.

duchenpaul avatar Jun 15 '24 11:06 duchenpaul

Could this be supported via a query parameter solution?

https://registry.jsonresume.org/thomasdavis?lang=en&theme=xx

The 'en' value would be passed as a value to a 'lang' name parameter. We know 'theme' already is a parameter, so would follow that pattern.

emeraldjava avatar Jun 16 '24 08:06 emeraldjava

Could this be supported via a query parameter solution?

https://registry.jsonresume.org/thomasdavis?lang=en&theme=xx

The 'en' value would be passed as a value to a 'lang' name parameter. We know 'theme' already is a parameter, so would follow that pattern.

That is nice as well, but I prefer to use gistname or such as instead of lang, as there may be other versions of resume, gistname - this will make the backend to retrieve the gist named so from the user's gists, in that case the user can have as many version/type of resumes as they want.

duchenpaul avatar Jun 16 '24 11:06 duchenpaul

query parametter seem to be fine! and gistname as parametter also !

https://registry.jsonresume.org/thomasdavis?gistname=myresume1&theme=xx

  • to get myresume1.json in gist of thomasdavis

https://registry.jsonresume.org/thomasdavis?gistname=myresume-en&theme=xx

  • to get myresume-en.json in gist of thomasdavis

all are done in getResumeGist that need to add gistname parametter.

to replace resume.json filter with the value of this parametter. https://github.com/jsonresume/jsonresume.org/blob/ff68aceb05f8452dddc56226851f752bc2991b53/apps/registry/lib/getResumeGist.js#L28

they are used in two place:

  • in generateResume : https://github.com/jsonresume/jsonresume.org/blob/ff68aceb05f8452dddc56226851f752bc2991b53/apps/registry/lib/generateResume.js#L37
  • in apps/registry/app/[username]/layout.js : https://github.com/jsonresume/jsonresume.org/blob/ff68aceb05f8452dddc56226851f752bc2991b53/apps/registry/app/%5Busername%5D/layout.js#L11

in the first we can add req.query to retrive gistname parametter. but in the second a don't know how to retrive the req.query (i'm not so fluent with javascript)...

there another place that reference resume.json and gist.githubusercontent.com: https://github.com/jsonresume/jsonresume.org/blob/ff68aceb05f8452dddc56226851f752bc2991b53/apps/registry/app/components/Editor.js#L157

in that way you can resolve mutiple version of resume and multilingale resume.

mcarbonneaux avatar Oct 24 '24 12:10 mcarbonneaux

Sounds like we should just go with the query string, seems easy to implement.

thomasdavis avatar Nov 12 '24 12:11 thomasdavis

✅ Implementation Complete

I've successfully implemented multi-gist support via the ?gistname query parameter. Users can now maintain and access multiple resume versions!

How to Use

Access different resume versions by adding the ?gistname parameter:

https://registry.jsonresume.org/username?gistname=resume-en.json
https://registry.jsonresume.org/username?gistname=resume-fr.json
https://registry.jsonresume.org/username/json?gistname=resume-en.json
https://registry.jsonresume.org/username/timeline?gistname=resume-en.json

Without the parameter, it defaults to resume.json for backward compatibility.

Implementation Details

Modified Files:

  1. lib/getResumeGist.js - Added optional gistname parameter with default fallback
  2. lib/generateResume.js - Extracts and passes gistname from query params
  3. app/providers/PublicResumeProvider.js - Reads gistname from URL using useSearchParams()
  4. app/docs/components/ResumeEndpoint/EndpointInfo.jsx - Documented new query parameter

Flow:

  1. User requests /username?gistname=resume-en.json
  2. PublicResumeProvider reads gistname from searchParams
  3. API route receives gistname in req.query
  4. generateResume() extracts and passes to getResumeGist()
  5. getResumeGist() fetches specified gist file from GitHub

Works with:

  • Public pages: /json, /timeline
  • API endpoints: /api/username, /api/username.pdf, etc.
  • Theme parameter: ?gistname=resume-en.json&theme=elegant

Build Status: ✅ Build passes successfully

See commit: dd7bc6c

thomasdavis avatar Oct 05 '25 04:10 thomasdavis

Thanks for your efforst, but I verified https://registry.jsonresume.org/duchenpaul?gistname=cn.json, it shows {"code":{"code":"NON_EXISTENT_GIST","message":"You have no gists named resume.json or your gist is private"}}, My json resume is here, maybe I am not using correctly or you haven't deployed?

duchenpaul avatar Oct 05 '25 08:10 duchenpaul

it's work fine for me !

mcarbonneaux avatar Oct 13 '25 07:10 mcarbonneaux

Yes, it works, thanks for the hint.

duchenpaul avatar Oct 13 '25 08:10 duchenpaul