Xavier's personal portfolio of work.
- Get variables for
.env.production.examples
- Depending on how you're deploying (on a server or a service), you may not use
the
.env.production
file but in any case you'll need the tokens, variables, and IDs.
You can download a file with all the environment variables from Vercel for local
development. In the Vercel account, the env vars marked with Development
will
be used when pulling with this method.
- Download the Vercel CLI:
npm i -g vercel
- Authenticate and link project:
vercel link
- Download env vars file:
vercel env pull <download_filename>
-
Create a Markdown file under
pages/articles/
. This path will be used in the URL of the article page withoutpages/
and the.md
extension.- Use all lowercase
- Use hyphens and not underscores
-
Add a YAML metadata section to the top of the Markdown file. See
article_configs/process_articles.ts
underMetadataType
for fields required and available. -
The
title
field is the header of the entire article. -
Make sure the
cardPageLink
field is the path to the article found in the repository without thepages/
directory. -
The
tagsId
field can be specified a listtagIds: [tag1, tag2]
or button list:tagIds: - tag1 - tag2
IMPORTANT: To make an article accessible through the URL and in general, you
have to explicitly include the filename with the extension in
article_configs/article_order_config.ts
.
- Check the
article_configs/filters_config.ts
file to make sure your desired filters are included and labeled properly. These are the filter options a user can filter preview cards by. The tag MUST match exactly thetagIds
in the Markdown file to be included in a filter.
Write your Markdown article. At build time, the Markdown file will be converted to HTML with styles applied.
Use the Markdown for H6 as caption for photos. Example: ###### My caption
.
Images will fill the width of the article container. Specify the height of the image to make the image smaller than the container. Only specify the height as the image will maintain ratio when height is specified.
![{h: 200}](my/article/image.webp)
If the image is above the fold when the article first renders, you can assign a
priority load flag the same way you would use
[priority](https://nextjs.org/docs/pages/api-reference/components/image#priority)
in NextJS or ReactJS:
![{priority}](my/article/image.webp)
Compress images.
Favor WEBP format for quality and compression.
Use this snippet for making iframe
responsive and replace the src:
<div
style="padding-bottom:56.25%; position:relative; display:block; width: 100%"
>
<iframe
width="100%"
height="100%"
src="https://youtu.be/j5a0jTc9S10?si=eGX-bRyQGBp4cAed"
frameborder="0"
allowfullscreen=""
style="position:absolute; top:0; left: 0"
>
</iframe>
</div>
NOTE: For best results from YouTube, use
https://www.youtube-nocookie.com/embed/27kAuEFGduI?si=rYG3QUug9_FN5nEO&start=5
with nocookie
if using the start=
parameter.
To make embedded content such as HTML rendered, we use rehypeRaw
plugin for
ReactMarkdown more info.
You can add recommendations to boost credibility and give insight to your quality of work.
Tend to use LinkedIn Recommendations since recommendation givers can be verified.
- Copy and paste recommendation and relevant data in
recommendations/ordered_recommendations.yaml
. List is ordered. - See
recommendations/RecommendationType.ts
for fields. - Download the profile picture from LinkedIn of the recommendation giver and
upload to
public/recommendations/profile_pics/
. Be sure to specify the picture in the ordered_recommendations.yaml.
Not adding a config
variable will secure all pages in web application.
middleware.js
export { default } from "next-auth/middleware"
https://next-auth.js.org/configuration/nextjs#middleware
Change the following variables.
- In the
env
file, setNEXT_PUBLIC_AUTH_USERS
totrue
to block elements if user is not authenticated. - In
middleware.ts
, choose the pattern to block if user is not authenticated.
NOTE: Since NextJS forbids variables and conditional statements in middleware.ts just comment out the unused option.
Adding boolean values in .env
files will return as true every time. Process
the string to match "true" or "false".
NEXT_PUBLIC_CAPTCHA=false
for example will always return true if evaluated
since the value is a type string.
Specify a NEXTAUTH_SECRET=
in the ENV file which is required for productions:
https://next-auth.js.org/configuration/options#secret
Check to make sure the ENV vars are formatted correctly.
Must match what you entered with OAuth provider NEXTAUTH_URL=
.
There are multiple places in the OAuth provider where you may need to specify the URLs for the OAuth to recognize the call from the application backend.