Skip to content

Commit 504a1b3

Browse files
Zé Bateiraolizillaterichadbourne
authored
Fix: more seo updates (#521)
* fix: add trailing slash to sitemap optimize build chunks for each route * feat: allow to override page title in the title template * feat: add more properties to the sitemap * fix: remove duplicate h1 and remove wrong h2 and h3 * fix: add missing alt attributes to images * fix: tests need an update because of the headdings changes * fix: remove errors on 404 pages * fix: suggestions from code review Co-authored-by: Oli Evans <[email protected]> * fix: remove sitemap from version control * fix: wrong condition * fix: test lesson content is correct * fix incorrect merge Co-authored-by: Oli Evans <[email protected]> Co-authored-by: terichadbourne <[email protected]>
1 parent 4597576 commit 504a1b3

27 files changed

+140
-146
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
node_modules
33
/dist
4+
/public/sitemap.xml
45

56
# local env files
67
.env*

cypress/integration/tutorials.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function advanceThroughLessons (tutorialId) {
253253

254254
it(`finds ${tutorialTitle} landing page with links to correct ${lessonCount} lessons plus resources`, function () {
255255
cy.visit(`/${tutorialName}/`)
256-
cy.contains('h2', tutorialTitle)
256+
cy.contains('h1', tutorialTitle)
257257
cy.get(`[data-cy=lesson-link-standard]`).should('have.length', lessonCount)
258258
cy.get(`[data-cy=lesson-link-resources]`).should('have.length', 1)
259259
// show that correct links are in correct order, but don't click through to test them
@@ -269,13 +269,11 @@ function advanceThroughLessons (tutorialId) {
269269
.and('have.attr', 'href', `/${tutorialName}/resources`)
270270
})
271271

272-
// const hasResources = tutorials[tutorialId].hasOwnProperty('resources')
273272
it(`uses lesson links and nav links btw landing page and 1st lesson`, function () {
274273
cy.visit(`/${tutorialName}/`)
275274
cy.get(`[href="/${tutorialName}/01"]`).click()
276275
cy.url().should('include', `/${tutorialName}/01`)
277276
cy.get(`[data-cy=tutorial-landing-link]`).click() // test nav link back to tutorial landing page
278-
cy.contains('h2', tutorialTitle)
279277
cy.get(`[href="/${tutorialName}/01"]`).click()
280278
cy.contains('h1', lessons[0].title)
281279
})
@@ -300,6 +298,10 @@ function advanceThroughLessons (tutorialId) {
300298

301299
let nextLessonNr = lessons[index + 1].formattedId
302300

301+
it('should show the lesson text', () => {
302+
cy.get('[data-cy-text]').should('have.attr', 'data-cy-text', lesson.html)
303+
})
304+
303305
// TEXT LESSONS ONLY
304306
if (lessonType === 'text') {
305307
it(`shows enabled next button`, function () {

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build]
2-
command = "npm run scripts:build:data -- --dry-run=false && npm run test:jest && npm run build"
2+
command = "npm run sitemap && npm run scripts:build:data -- --dry-run=false && npm run test:jest && npm run build"
33
publish = "dist"
44

55
[build.environment]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"scripts:build:data": "node scripts/commands/build-data",
1818
"scripts:googleapis-generate-token": "node scripts/commands/googleapis-generate-token",
1919
"scripts:wizard": "node scripts/commands/wizard/index.js",
20-
"sitemap": "rm public/sitemap.xml && vue-cli-service sitemap",
20+
"sitemap": "rm -f public/sitemap.xml && vue-cli-service sitemap",
2121
"start": "npm run serve",
2222
"test": "start-server-and-test serve http://localhost:3000 cy:run",
2323
"test:jest": "jest --maxWorkers=1 --verbose"

public/sitemap.xml

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/Header.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
<img src="../static/images/ps_symbol_color.svg" alt="ProtoSchool" class="w3" />
88
</a>
99
<div class="header-text ml3">
10-
<h1 class="ma0 fw4">
10+
<div class=" header-title ma0 fw4">
1111
<span class="montserrat fw4">Proto</span>
1212
<span class="montserrat fw2">School</span>
13-
</h1>
14-
<h2 class="ma0 montserrat fw3">
13+
</div>
14+
<div class="header-slogan ma0 montserrat fw3">
1515
Interactive tutorials on decentralized web protocols
16-
</h2>
16+
</div>
1717
</div>
1818
</div>
1919
</section>
@@ -37,27 +37,27 @@ export default {
3737
</script>
3838

3939
<style scoped>
40-
.header-text h1 {
40+
.header-title {
4141
font-size: 32px;
4242
}
43-
.header-text h2 {
43+
.header-slogan {
4444
font-size: 16px;
4545
}
4646
4747
@media screen and (min-width: 620px) {
48-
.header-text h1 {
48+
.header-title {
4949
font-size: 40px;
5050
}
51-
.header-text h2 {
51+
.header-slogan {
5252
font-size: 20px;
5353
}
5454
}
5555
5656
@media screen and (max-width: 498px) {
57-
.header-text h1 {
57+
.header-title {
5858
font-size: 24px;
5959
}
60-
.header-text h2 {
60+
.header-slogan {
6161
font-size: 12px;
6262
}
6363
}

src/components/Lesson.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,16 @@
2323
<h1>{{isResources ? 'Resources' : lesson.title}}</h1>
2424
<Concepts v-if="concepts" :concepts="concepts" />
2525
<Resources v-if="isResources" :data="resources" />
26-
<div v-else class="lesson-text lh-copy" v-html="text"></div>
26+
<!--
27+
only add the text on data-cy-text when not in production
28+
otherwise the html document will be bigger than it needs to in production
29+
-->
30+
<div
31+
v-else class="lesson-text lh-copy"
32+
v-html="text"
33+
:data-cy-text="!isProduction && text"
34+
>
35+
</div>
2736
</section>
2837
<section v-if="challenge || isMultipleChoiceLesson" :class="{expand: expandChallenge}" class="challenge center pa3 ph4-l flex flex-column">
2938
<div class="flex-none">
@@ -247,7 +256,8 @@ export default {
247256
uploadedFiles: window.uploadedFiles || false,
248257
choice: localStorage[self.cacheKey] || '',
249258
cachedChoice: !!localStorage['cached' + routePath],
250-
output: self.output
259+
output: self.output,
260+
isProduction
251261
}
252262
},
253263
computed: {

src/components/Navigation.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<!-- standard nav -->
3232
<div v-else class="flex-auto link fw6 f5 db bb border-aqua">{{currentPage}}</div>
3333
<button @click="toggleHamburger" class="menu-toggle button-reset bg-transparent b--transparent">
34-
<img v-if="isHamburgerClosed" src="../static/images/burger.svg"/>
35-
<img v-else src="../static/images/close.svg"/>
34+
<img v-if="isHamburgerClosed" src="../static/images/burger.svg" alt="open navigation menu" />
35+
<img v-else src="../static/images/close.svg" alt="close navigation menu" />
3636
</button>
3737
</div>
3838
<!-- hamburger displayed when requested -->

src/components/Tutorial.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
:alt="tutorial.project.name"
1515
style="height: 23px"
1616
/>
17-
<h1 class="f6 mv0 fw2">{{tutorial.project.name}}</h1>
17+
<h2 class="f6 mv0 fw2">{{tutorial.project.name}}</h2>
1818
</div>
1919
<div class="flex justify-between flex-row items-start mb1">
2020
<div class="flex flex-row items-center mt1">
21-
<h2 class="ma0 f3 fw5">
21+
<h1 class="ma0 f3 fw5">
2222
<template v-if="isLanding !== true">
2323
<router-link :to="landingLink" data-cy="tutorial-title">{{tutorial.title}}</router-link>
2424
</template>
2525
<template v-else>
2626
{{tutorial.title}}
2727
</template>
28-
</h2>
28+
</h1>
2929
<span v-if="isTutorialPassed(tutorial)" class="ml2 f3">🏆</span>
3030
</div>
3131
<TypeIcon

src/components/cards/EventCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<p class="f7 fw5 ma0 pt0 lh-copy ttu teal mb3">
55
{{displayTimeZone}}
66
</p>
7-
<h3 class="ma0 mb1 f3 fw9 ttu">{{ isVirtual ? "Virtual" : city }}</h3>
7+
<div class="ma0 mb1 f3 fw9 ttu">{{ isVirtual ? "Virtual" : city }}</div>
88
<p v-if="!isVirtual" class="f5 fw5 ma0 pt0">
99
<span v-if="country" class="fw7">{{country}}</span>
1010
<span v-if="region"> - {{region}}</span>

0 commit comments

Comments
 (0)