Skip to content

Commit

Permalink
Improve Page Performance
Browse files Browse the repository at this point in the history
- Fix "Eliminate render-blocking resources"
- Add "Preconnect to required origins"
- Fix "Image elements do not have explicit width and height"
- Add lazy loading to about/ images

Signed-off-by: Randy <randymoralesg@gmail.com>
  • Loading branch information
randymorales committed Jul 19, 2021
1 parent 9a3b05d commit bb42e50
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ export default class MyDocument extends Document {
title='RSS feed for blog posts'
href='https://randymorales.dev/rss-en.xml'
/>
<link rel='preconnect' href='https://fonts.googleapis.com' />
<link rel='preconnect' href='https://fonts.gstatic.com' crossorigin />
<script
src='https://kit.fontawesome.com/2c36e9b7b1.js'
crossOrigin='anonymous'
async
></script>
</Head>
<body>
Expand Down
3 changes: 3 additions & 0 deletions pages/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,23 @@ export default function About() {
width='320'
height='680'
priority
loading="lazy"
/>
<Image
src='/images/mtb.jpg'
alt='moravia mtb photo'
width='490'
height='680'
priority
loading="lazy"
/>
<Image
src='/images/alajuela.jpg'
alt='iberico photo'
width='450'
height='680'
priority
loading="lazy"
/>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions pages/blog/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Image from 'next/image'
import Link from 'next/link'
import { useRouter } from 'next/router'

import React, { useEffect } from 'react'
import {createRef, useEffect } from 'react'

import {
CommentsRepo,
Expand All @@ -21,7 +21,7 @@ import blogStyles from '@/styles/blog.module.css'
export default function Post({ postData }) {
const router = useRouter()
const { locale } = router
const commentBox = React.createRef()
const commentBox = createRef()
const prism = require('prismjs')
const pageInfo = {
url: SiteBaseURL + `/${locale}` + PostsDirectory + postData.id,
Expand Down
2 changes: 2 additions & 0 deletions styles/blog.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@

.postContent p img {
border: 1px solid var(--content-text-color);
height: auto;
width: 100%;
}

/* ******** Media Queries ******** */
Expand Down
2 changes: 1 addition & 1 deletion styles/globals.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'https://fonts.googleapis.com/css?family=Inter&display=swap';
@import 'https://fonts.googleapis.com/css2?family=Inter&display=swap';

/* ******** Global CSS ******** */

Expand Down

0 comments on commit bb42e50

Please sign in to comment.