|
1 |
| -title: The specifics - Vocabulary Front |
| 1 | +title: The specifics - Revamping CCOS |
2 | 2 | ---
|
3 | 3 | categories:
|
4 | 4 | outreachy
|
@@ -33,7 +33,7 @@ And many more.
|
33 | 33 |
|
34 | 34 | ### How did I use it? — Examples
|
35 | 35 |
|
36 |
| -As I stated before, I have added Vocabulary by updating all the Templates in the CCOS Lektor project. |
| 36 | +As I stated before, I have added Vocabulary by updating all the Templates in the CCOS [Lektor](https://www.getlektor.com/) project. |
37 | 37 |
|
38 | 38 | As far as components are concerned, I just had to paste the code snippets given on the Vocabulary’s website with the requires changes -
|
39 | 39 |
|
@@ -164,12 +164,142 @@ This is code for the Hero section of the home page.
|
164 | 164 | }
|
165 | 165 | ```
|
166 | 166 |
|
167 |
| -<figure style="text-align: center;"> |
| 167 | +<figure> |
168 | 168 | <img src="output.png" alt="Output">
|
169 | 169 | <figcaption>Output</figcaption>
|
170 | 170 | </figure>
|
171 | 171 |
|
172 |
| -### How you can use it and also contribute to it? |
| 172 | +### Improvements in the Lektor project - |
| 173 | + |
| 174 | +I tried to write the perfect code that is cleaner and readable. I would try to demonstrate my effort using the home page code where I used [Lektor Flowblocks](https://www.getlektor.com/docs/models/flow/). The new homepage design have four sections where each section communicated something and I realized they were all independent and building the whole page through one single template would become a bit messy and hard to handle. So I did some research and found a way where I could build sub-templates and use them all to develop a single page and Lektor’s flowblocks allowed me to do so. Here is one of the flowblock and if you want to check out the whole working you can go to — [CCOS Repository](https://github.com/creativecommons/creativecommons.github.io-source). |
| 175 | + |
| 176 | +#### Recent Blog Post block - |
| 177 | + |
| 178 | +##### The block Template - |
| 179 | + |
| 180 | +``` |
| 181 | +{% from "macros/author_name.html" import render_author_name %} |
| 182 | +
|
| 183 | +<section class="recent-posts"> |
| 184 | + <div class="container"> |
| 185 | + <div class="level"> |
| 186 | + <h2 class="is-paddingless level-left"> |
| 187 | + {{ this.title }} |
| 188 | + </h2> |
| 189 | + <span class="level-right"> |
| 190 | + <a class="posts-link" href="/blog">See all posts <i class="icon angle-right"></i></a> |
| 191 | + </span> |
| 192 | + </div> |
| 193 | + <div class="columns"> |
| 194 | + {% for post in site.query('/blog/entries') %} |
| 195 | + {% if loop.index <= 3 %} |
| 196 | + {% set author = post.parent.parent.children.get('authors').children.get(post.author) %} |
| 197 | + <div class="column is-one-third is-paddingless padding-horizontal-big padding-top-bigger"> |
| 198 | + <article class="card entry-post horizontal no-border blog-entry"> |
| 199 | + <header> |
| 200 | + <figure class="image blog-image"> |
| 201 | + {% if author.about %} |
| 202 | + {% if author.md5_hashed_email %} |
| 203 | + <img class="profile" src="https://secure.gravatar.com/avatar/{{ author.md5_hashed_email }}?size=200" |
| 204 | + alt="gravatar" /> |
| 205 | + {% endif %} |
| 206 | + {% endif %} |
| 207 | + </figure> |
| 208 | + </header> |
| 209 | + <div class="blog-content"> |
| 210 | + <h4 class="b-header"><a class="blog-title" href="{{ post|url }}">{{ post.title }}</a></h4> |
| 211 | + <span class="blog-author">by <a class="author-name" href="{{ author|url }}">{{ render_author_name(author) }}</a> |
| 212 | + on {{ post.pub_date|dateformat("YYYY-MM-dd") }}</span> |
| 213 | + <div class="excerpt"> |
| 214 | + {{ post.body | excerpt | string | striptags() | truncate(100) }} |
| 215 | + </div> |
| 216 | + </div> |
| 217 | + </article> |
| 218 | + </div> |
| 219 | + {% endif %} |
| 220 | + {% endfor %} |
| 221 | + </div> |
| 222 | + </div> |
| 223 | +</section> |
| 224 | +``` |
| 225 | + |
| 226 | +##### The block Model - |
| 227 | + |
| 228 | +``` |
| 229 | +[block] |
| 230 | +name = Recent Posts |
| 231 | +
|
| 232 | +[fields.title] |
| 233 | +label = Title |
| 234 | +type = string |
| 235 | +``` |
| 236 | + |
| 237 | +##### The block styling - |
| 238 | + |
| 239 | +``` |
| 240 | +// Recent-posts section - Home page |
| 241 | +.recent-posts { |
| 242 | + background-color: rgba(4, 166, 53, 0.1); |
| 243 | +
|
| 244 | + .container { |
| 245 | + @extend .padding-vertical-xl; |
| 246 | + @extend .padding-horizontal-big; |
| 247 | +
|
| 248 | + .columns { |
| 249 | + @extend .padding-top-bigger; |
| 250 | + @extend .padding-bottom-xl; |
| 251 | + } |
| 252 | + } |
| 253 | +
|
| 254 | + .blog-title { |
| 255 | + @extend .has-color-dark-slate-gray; |
| 256 | + } |
| 257 | +
|
| 258 | + .posts-link { |
| 259 | + @extend .has-color-forest-green; |
| 260 | + @extend .body-normal; |
| 261 | +
|
| 262 | + font-weight: bold; |
| 263 | + line-height: 1.5; |
| 264 | + text-decoration: none; |
| 265 | +
|
| 266 | + .icon { |
| 267 | + @extend .has-color-forest-green; |
| 268 | + @extend .padding-left-small; |
| 269 | + } |
| 270 | + } |
| 271 | +} |
| 272 | +``` |
| 273 | + |
| 274 | +<figure> |
| 275 | + <img src="output2.png" alt="Output"> |
| 276 | + <figcaption>Output — Recent blog posts.</figcaption> |
| 277 | +</figure> |
| 278 | + |
| 279 | +I would also like to point out the amazing Query functionality provided by Lektor where you can access the child pages of the root. Here I am accessing blog posts from our Blog page and limiting the count of posts to three. |
| 280 | + |
| 281 | +### Difference in Experience |
| 282 | + |
| 283 | +The level of user experience has been significantly elevated due to the use of Vocabulary. I would like to point one of the major experience change here. The major part of the website is guidelines — we have guidelines for contributing, guidelines for how to join a community, guidelines for how to write a blog and many more. The new website has cleaner and readable guideline with a proper hierarchy and every piece of information is made accessible using secondary navigation. |
| 284 | + |
| 285 | +##### Below are the images of some guidelines pages from new website. |
| 286 | + |
| 287 | +<figure> |
| 288 | + <img width="300" height="300" src="new1.png" alt="Screenshot"> |
| 289 | + <img width="300" height="300" src="new2.png" alt="Screenshot"> |
| 290 | + <img width="300" height="300" src="new3.png" alt="Screenshot"> |
| 291 | + <figcaption>Screenshots from new website</figcaption> |
| 292 | +</figure> |
| 293 | + |
| 294 | +##### Below are the images of some guidelines pages from old website. You can see the difference of experience in both cases. |
| 295 | + |
| 296 | +<figure> |
| 297 | + <img width="400" src="old1.png" alt="Screenshot"> |
| 298 | + <img width="400" src="old2.png" alt="Screenshot"> |
| 299 | + <figcaption>Screenshots from old website</figcaption> |
| 300 | +</figure> |
| 301 | + |
| 302 | +### How you can use Vocabulary and also contribute to it? |
173 | 303 |
|
174 | 304 | Vocabulary is very easy to use. It is intuitive, consistent and highly reusable. Vocabulary uses Storybook to present each visual element that makes it very convenient for a user to integrate Vocabulary in their project. The code snippets attached with every element can be copied as it is and can be used. The code snippets above indicate how the library can be used and how easily you can achieve desired web pages. For more details, you can visit [usage guidelines](https://cc-vocabulary.netlify.app/?path=/docs/vocabulary-usage--page).
|
175 | 305 |
|
|
0 commit comments