Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Implement google schema markup (only 2 questions added at the moment) #90

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

dazetoyo
Copy link

@dazetoyo dazetoyo commented Mar 17, 2021

I wrote a script that adds schema markup to the pages generated. Schema markup refers to this
image

Why is this useful?
Schema markup improves the SEO, it's basically code (semantic vocabulary) that you place on your website to help the search engines return more informative results for users.

I tested it using a ngrok server created from my local repo.
image

test can be done on https://search.google.com/test/rich-results

Right now it's only written for 2 items. You would probably want to review the text I wrote because it needs to be rephrased.
I will write the code for the next few, or extrapolate the one written for now.

Also please use Github Desktop.

googleSchema.js Outdated Show resolved Hide resolved
Copy link

@johnpyp johnpyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

googleSchema.js Outdated Show resolved Hide resolved
googleSchema.js Outdated Show resolved Hide resolved
googleSchema.js Outdated Show resolved Hide resolved
googleSchema.js Outdated Show resolved Hide resolved
googleSchema.js Outdated Show resolved Hide resolved
@ILiedAboutCake
Copy link
Contributor

There are some clear improvements that need to be made before this will be merged to production

@kylegrover
Copy link

Seems this should just be rendered as part of the page. I'd look to add the question and answer as optional yaml frontmatter, then create a tag that pulls in that data and outputs the <script> with json content. You'll also want to consider expanding that schema tag to include some information about the top level Entity (the website)

@dazetoyo dazetoyo closed this Mar 17, 2021
@dazetoyo
Copy link
Author

closing until I go trough some of the changes suggested by @johnpyp

@dazetoyo
Copy link
Author

done the changes and reopened it. Here's another preview showing how it would look on live.
Thank you all for your feedback.

image

@dazetoyo dazetoyo reopened this Mar 21, 2021
@ILiedAboutCake
Copy link
Contributor

@Steven-Bonnell-II Is this something you want and are willing to maintain? I can't think of anything less I want to do than asking myself questions and writing them out about your philosophy content for every page you create.

@dazetoyo
Copy link
Author

@Steven-Bonnell-II Is this something you want and are willing to maintain? I can't think of anything less I want to do than asking myself questions and writing them out about your philosophy content for every page you create.

plz no bully https://youtu.be/iYRcPjKTKm8?list=PLFs19LVskfNzQLZkGG_zf6yfYTp_3v_e6&t=17181

If its too much work I can also try to write an algorithm to generate them:
Something like:
Question: "What does Destiny think about TITLE" where TITLE would be each H2 on each section
Answer: Take the first Phrase from each section that starts with "I ... " and insert it here as an answer.

Example - philosophy My Foundational Beliefs
Question: "What does Destiny think about My Foundational Beliefs"
Answer: "I have a video where I break down how I construct my philosophical worldview, which I highly recommend watching for a fleshed-out understanding of my position."

However this approach would leave little room for customization and the result might not be satisfactory every time ... The safest way would be to handwrite each question.

@mattroseman
Copy link
Contributor

mattroseman commented Mar 24, 2021

It's possible you could just have one set of questions/answers for every page on the site.

It might not match up with the exact page that shows up in google results, but you don't have to constantly update it when you make new pages.

(google might ding you for having questions/answers that they don't think match the specific page)

@dazetoyo
Copy link
Author

dazetoyo commented Mar 24, 2021

It's possible you could just have one set of questions/answers for every page on the site.

yeah, for example having 4 questions / answers on philosophy 4 on politics, 1 on about etc... Would remove the massive workload

It might not match up with the exact page that shows up in google results, but you don't have to constantly update it when you make new pages.

the way its made right now is that it only injects it in the specific page.

(google might ding you for having questions/answers that they don't think match the specific page)

Right now it only works with philosophy questions, a new ID needs to be injected for each page when the questions are ready for said page. Google will only get the schema when it gets to /docs/philosophy

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants