- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
<template>
<main>
<section class="header">
<div class="content column">
<h1>{{ content.head.title }} | Rosetta Stone®</h1>
<p>{{ content.header.p }}</p>
<a href="#">{{ content.header.cta }}</a>
</div>
</section>
<section v-for="(article, i) in marked" :key="i">
<!-- If it's a text article -->
<article v-if="article.type == 'text'">
<div class="content">
<div class="title">{{ article.title }}</div>
<div class="paragraphs">
<div v-for="(content, j) in article.contents" :key="j">
<div v-if="content.type == 'paragraph'">
<p v-for="(p, k) in content.paragraphs" :key="k" v-html="p"></p>
</div>
</div>
</div>
</div>
</article>
<article v-if="article.type == 'img'" class="fluid hero" :data-hero-index="i">
<!-- For responsive hero images -->
<style type="text/css">
article[data-hero-index="{{i}}"] {
background: url(/nuxt-assets/img/seo-pages/hero/{{article.src}}-{{i}}.jpg);
}
@media (max-width: 500px) {
article[data-hero-index="{{i}}"] {
background: url(/nuxt-assets/img/seo-pages/hero/{{article.src}}-{{i}}-mobile.jpg);
}
}
</style>
</article>
</section>
</main>
</template>
<script>
// Will be needed to lazyload hero images later.
require("intersection-observer");
import content from "~/data/seo-pages/learn-spanish.yaml";
import Markdown from 'markdown-it'
let md = new Markdown({ html: true })
export default {
data() {
return {
content: { ...content },
heroes: []
};
},
async asyncData ({ params, error, payload }) {
return {
content: payload.params
}
},
computed: {
marked () {
let parsed = this.content.articles.map(article => {
if (article.type == 'text') {
for (let content of article.contents) {
if (content.type == "paragraph") {
for (let [i, p] of content.paragraphs.entries()) {
content.paragraphs[i] = md.render(p)
}
}
}
}
return article
})
return parsed
console.log(parsed)
}
}
};
</script>
<style lang="stylus" scoped>
h1, h2, h3, h4, h5 {
font-family: helvetica;
}
main {
font-family: effra;
display: flex;
flex-direction: column;
}
section {
display: flex;
flex-direction: column;
align-items: center;
// align-items: center;
}
.content {
width: 100%;
max-width: 1160px;
display: flex;
&.column {
flex-direction: column;
}
}
.header {
text-align: center;
margin: 3em 0 4em 0;
a {
background: #0098db;
display: inline-block;
width: 220px;
margin: 0 auto;
color: #fff;
text-decoration: none;
padding 20px 0;
border-radius: 8px;
margin-top: 2em;
}
}
article {
width: 100%;
display: flex;
justify-content: center;
&.fluid {
width: 100%;
background-size: cover;
}
.title {
min-width: 327px;
background: yellow;
padding-right: 2em;
}
.paragraphs {
display: flex;
flex-direction: column;
background: pink;
}
}
.hero {
height: 355px;
}
</style>