Site Building (Level 2)
Drupal Onboarding project tasks used for learning
Modules: Metatag
Metatag is a powerful module used for adding additional info of the page for search engines. You can also rewrite default page title under certain conditions and do all SEO adjustments to the page.
First off, create a different title on front page. The page title (the one in tab in browser) should be '[site:name] | We have all the events, locations and companies in the city'.
Next create OG tag for image which will define which image will be pulled on each content type: on Event and Location it should be field Image, and on Company it should pull the field logo.
Also we want to set the text for Tweet on Event content type if someone wants to tweet this page. Create a field on content type Event and then set that field to be shown in twitter share window if someone shares the page.
Test if everything is as it should be by inspecting the source code of your page.
Modules: XML Sitemap or Simple XML sitemap
In Drupal 8 there are two options of adding XML Sitemap. Module XML Sitemap was a default in Drupal 7 and still has lots of user, but in the meantime Simple XML Sitemap also came by, so now we have two solutions.
Create XML Sitemap which will grab all content types. Events should have a priority set to 0.8, locations and companies to 0.5 and all the other nodes to 0.3.
First try with one module than uninstall it and try with the other one as well, so you'll see the differences.
Modules: Flag / "Add to favourites" on Event page
For all the events create 'Add to favorites' link. Put it somewhere on the Event page. After you'll do this, also create a page with url /my-favorite-events, which will display a list of all the events that the current logged in user added to favorites.
Hints:
- Check Flag module.
Modules: Comments and Flag
Enable comments on Event content type. All authenticated users should be able to add comment on events.
Additionally create a flag that will serve as a Like button for certain comment. Again, only authenticated users can like the comment.
Module: Views infinite scroll
There are six items on /events page by default on design. If you have more of them you probably implemented a pager.
We want a list of events to be an endless page, where events are automatically loaded when reaching the end of a screen.
Check out Views infinite scroll module (https://www.drupal.org/project/views_infinite_scroll) and figure out how you can achieve this.
In addition to that, we don't want a pager on /companies page as well, but instead of automatically adding items to the bottom of the page, we want a 'Load more' button, which loads additional six items every time it's pressed.
Module: Webform
Webform is mainly used for user-facing forms. questionnaires, contact forms etc.
Create a basic Contact us form with fields: first name, last name, company, contact email, phone number, message.
After you're done with this, we want to create a multi step form. First step are the fields mentioned above, for the second part we want to get some feedback. The fields should be: How do you like our products?, How likely it is that you will recommend our products to your friends?, Your age (only create ranges eg. 0-18, 19-30, 31-50 ...).
Module: Rabbit Hole
This module is used, when you don't want to show full entity display (node/123, taxonomy/term/12 ...), but you only want to use it in lists (e.g. View of nodes) or as category (taxonomy term on node).
Configure Rabbit hole in a way, that Slider nodes redirect to home page and Event type taxonomy term redirects to /events.
Entity reference View
Let's assume that we have lots of locations on our site. Some of them are not operating anymore and we shouldn't be able to select them on the Event, but we have to keep them in the system cause they are attached to past events.
We want to have an option to set which location is not operating and then on the event, only select among those who are. Create a new field on Location content type that will store this value. Then create an 'Entity reference' view that filters locations by the value of this field. On the Event content type put an entity reference on the Location field to the view you have created.
Example: You have a location which has a field »Is operating«. When you are creating an event you would like on the Location field to only list locations that are still operating.
https://www.ostraining.com/blog/drupal/drupal-8-entity-reference-view/
Add REST endpoint for upcoming events with Views
We want to provide an url with JSON of our upcoming events on /rest/upcoming-events to offer the list for displaying on other web pages. Display all upcoming events with fields: title, description, start_date, end_date, eventy_type, image, organizer (with link), location (with link).
Everything you need is covered in this tutorial:
https://drupalize.me/tutorial/add-rest-endpoint-views?p=3377
Multilingual
Make your web page multilingual. Add additional two languages (for example Slovenian and German, but you're free to choose). Make all content translatable - nodes and taxonomies too. Additional request is that all images on Company, Location and Event are not translatable. So when one image is added it is displayed on all languages and user shouldn't change it for other languages.
When you'll be set, add a language switcher block in header and translate some or all of the content.
https://www.drupal.org/docs/8/multilingual https://drupalize.me/videos/whats-new-drupal-8-multilingual?p=2075