Would you like to buy me a ☕️ instead?
Although, nowadays, my main focus at work is to build app like websites, at my former employer, I generally worked on brochure pages. We built a variety of small to medium scale websites powered by the PHP based CMS Drupal.
A couple of days ago, I started thinking about how I would build such sites today. Drupal is a very powerful CMS and there is nothing inherently bad about it, but it’s very heavyweight and the frontend part is pretty outdated. Its strength lies in the editing and management of content, but it is very difficult to adapt the frontend to your own needs.
In today’s article we’ll explore how to combine the power of the headless CMS Contentful with the flexibility of a modern Vue.js frontend stack to build brochure sites and landing pages. We’ll set up our project using the Vue CLI and we’ll use the contentful npm package to fetch data from the Contentful API. Additionally we’ll use Vuex to store the data we’ve fetched from the API.
You can find the complete code, we’ll write in this article, on Github and you can view a demo of the application hosted on Netlify.
There are a ton of headless CMS options out there. Many of them are Open Source and can be self hosted. Although self hosting might seem favorable, nowadays I tend to outsource everything what’s outside of my main area of expertise (which is building complex frontends). Self hosting might seem like the more flexible and cheaper option but rather sooner than later the day comes when a major security vulnerability is discovered and you have to spend hours fixing all of the hacked websites of your clients. Besides that, you have to deal with angry customers and, of course, they don’t want to pay for any of it.
The final result: a landing page rendered by Vue.js
So after experimenting with a lot of self hosted and also cloud hosted headless content management systems, I decided to use Contentful. The user interface is by far the most intuitive of all of the systems I’ve tested. Furthermore it makes it really easy to handle images, so your clients can upload images in any format they wish and the Contentful API will handle cropping and resizing automatically, even with support for face detection.
Although the features of Contentful are pretty awesome, I’m of the opinion, that it’s way too expensive if you’re exceeding the limits of the micro plan. That’s why I’m still searching for a more affordable alternative for clients which, although they have a lot of content, don’t have the budget to spend a fortune every month on their website. If you can recommend me an alternative, please let me know on Twitter.
Creating a Landing Page content type with Contentful
I won’t go into much detail about how to create content types in Contentful. Just let me say that you can create content types for certain pages or sections of your website. You can choose from a handful of fields which you can add to your content types.
Create a new Landing Page content type in Contentful
The basic elements of our Landing Page content type will be a title (H1) and a short intro text. Furthermore we want to display some text and image content blocks (alternately text left, picture right / picture left, text right) and we want to be able to show a list of teasers at the bottom of the page. For this to work we need two more content types: Content Block and Teaser.
Add new fields to the Landing Page content type
After setting up our Landing Page content type and adding all necessary fields, we’re ready to create our first landing page: the homepage.
Create a new landing page
Setting up the project
Thanks to the awesome Vue CLI, setting up a Vue.js project has never been more convenient. If you want to start from scratch, please follow the instructions in the Vue CLI documentation. Otherwise you can check out the complete code featured in this article on GitHub.
Loading data form Contentful with Vue.js
We’ve set up our content types and created our first landing page, now we’re ready to fetch the data from the Contentful API to use it in our Vue.js application.
After installing the
contentful npm package, we’re able to create a client instance which we can use to fetch data from the Contentful API.
The landing page model
In the next step, we create a landing page model that is responsible for fetching the data from the API and bringing it into a format that meets our requirements.
Store the data in Vuex
We can now use the model to load and save data to the state using a Vuex action.
In the code snippet above, you can see the code for our landing page Vuex store module. Because the
state property returns a function, we can reuse this store module for multiple landing pages we might create in our application.
The homepage component
Our Vuex store is ready to fetch some data for us, so let’s build a new view component for our homepage.
src/components/views/Home.vue view component you can see above, dynamically registers the landing page store module we’ve built earlier and triggers the
GET_LANDING_PAGE action to fetch the landing page data from Contentful. In the screenshot below, you can see the current look of our application.
The title and the intro text are coming from Contentful
Do you want to learn more about advanced Vue.js techniques?
Register for the Newsletter of my upcoming book: Advanced Vue.js Application Architecture.
Rendering the content blocks
Instead of using the
getEntry() method to retrieve a single entity, we now use the
getEntries() method. The reason why we’re using
getEntries() is because this method resolves all references (to our content blocks for example) automatically for us. But because
getEntries() returns an array, we have to make some additional changes to our model so everything works with either arrays or single entities.
Resolving content blocks
Next we have to add the content blocks data to our model. Before we can do this though, we need a new
The content block content type contains an image field, images and other assets are basically entities of the content type asset which are referenced by the parent entity. So we need yet another model for our image field.
The image model is quiet simple, we only need the ID and the URL of the image. Now that we have all the content models we need, we can start to assemble them.
First we use the image model to resolve the image field inside of our content block model. In the following code snippet, we add the content block model to our landing page model.
The content block component
Now that our basic data structure is set up, we can update our Vue.js application to render the content blocks.
Above you can see the AppContentBlock component which is responsible for rendering a single content block entity. Note that we’re using the Contentful image API to automatically generate images for us in both, non-retina (
imageSrc) and retina (
imageSrcset) resolutions. The
w=360&h=250 parameters define the size of the image,
fit=thumb is for resizing and cropping the image,
fm=jpg makes sure the image is a
fl=progressive makes the
jpg progressive which provides a better loading behavior and
q=70 sets the
jpg quality (we can use a very low quality of
q=40 for our retina version because of the high resolution the file will still look good).
Finally we can integrate the
AppContentBlock component into our
Home view component.
Rendering the teasers
Last but not least, there is only one thing missing from our landing page: the teasers at the bottom. Rendering the teasers works basically the same as rendering the content blocks, so I won’t repeat everything again. Instead, you can take a look at the commit at GitHub.
The landing page with teasers
Like What You Read?
Follow me to get my latest Vue.js articles.
Wrapping it up
Although this approach is already quite powerful, there remain two problems with this methodology: SEO and initial page load performance. But there are ways around those issues, if you’re interested in how we can use pre-rendering for boosting the initial page load time and delivering static HTML to search engines, you can read the next article about this topic.
Building landing pages and brochure style websites with modern web technologies is awesome. By utilizing the power of headless, cloud hosted content management systems, you can build complex landing pages in a matter of hours. This is definitely the way how I’ll build landing pages and brochure sites in the future.
Aeroland – Vue JS App & Saas Landing Page Template
Aeroland is a VueJS Template that comes with dozens of powerful features. It is a multi-purpose landing page template. Some of its features include 5 different home page layouts, 100% responsive design, 12+ aeroland elements, 600+ Google web fonts, fixed footer, off sidebar, slick slider, clean and unique design, working contact form, detailed documentation, etc.
Aeroland comes with a regular license fee of just USD 24.
Fantasic – Vue JS App Landing Page Template
Fantasic is a VueJS template. It has a stunning and beautifully crafted design. It is a multi-purpose app landing page. Fantasic comes with multiple features. Some of its features include Vue Platform, 5 different home page variations, fast loading, clean code, valid HTML5/CSS3, Webpack & Babel, 1000+ icon fonts, 100% responsive design, speed optimized, detailed documentation, cross-browser support, pixel perfect design, Google web fonts, cross-browser support, easy customization, free updates, etc.
All these wonderful features of Fantasic VueJS template come with a regular license fee of just USD 24.
Gothic – Architecture Vue Nuxt JS Template
Give the best in building magnificent and user-friendly web user interfaces to showcase your architecture projects so you can reap what you sow. Gothic is a flexible and unique Vue Nuxt JS template that will provide you with unlimited possibilities in creating your website for architecture firms, interior designers, and anyone involved in construction and engineering. The template incorporates a fully responsive interface that adjusts to all device screens easily. Some of the cool features of this template include Icon font, Google Fonts, SEO-friendly code, No console error, and well documentation.
All these amenities of this modern Architecture Vue.JS template are available at a regular license fee of just USD 17.
Exomac – Corporate Business Vue Nuxt JS Template
If you are looking for a suitable Vue JS-based corporate business web template, you have come to the right place. Exomac is a perfect Vue JS-based web template for business and corporate company websites. It has the right combination of components, elements, design, and functionality. This modern Vue.JS Template is adorned with 11 webpages with 3 homepage variations. You will find it flexible to work with since the template doesn’t have JQuery dependency. It also has a fully responsive design ensuring an impeccable performance across all screen sizes. Some other remarkable features include Beautiful and Unique Design, Google Font & Local font for beautiful typography, Well Documented, Valid Component, Clean and commented code, and many more.
All these amenities of this modern Architecture Vue.JS template are available at a regular license fee of just USD 17.
MaxCoach – Online Courses & Education Vue Nuxt JS Template
MaxCoach – Online Courses & Education Vue Nuxt JS Template
If you want to have an interactive interface in your online courses and education website, you better opt for a well-functional and sophisticated education Vue JS template like Maxcoach. Aiming to provide a perfect solution for your online educational needs, this stunning Vue JS template comes with lots of amazing features at your disposal. You will find Google Font, Swiper Slider, Sticky Sidebar, Cross Browser Support, SEO Friendly codebase, No console error, and many more. Powered with the latest version of Vue JS and Nuxt JS, this comprehensive education Vue JS template has 50+ webpages in total with 9+ home variations.
MaxCoach – Online Courses & Education Vue Nuxt JS Template is available at a regular license fee of 24 USD only.
Brook – Creative Multipurpose Vue Nuxt JS Template
If you are searching for a multi-purpose Vue JS template, Brook is worth checking out. This wonderful and flexible Vue Nuxt JS template includes 25+ stunning homepages at your disposal. Brook Vue JS template rocks many great features that will help save additional time and raise your potential at the same time. From customizable home-pages, 21+ blogs & portfolio layouts to Cross-Browser Compatibility, Progressive web image, and no console error, Brook has it all available.
All the amenities of this versatile Vue JS web template are available at a regular license fee of 24 USD only.
Mitech – Vue Nuxt JS Technology & Blog Template
Mitech is a magnificent resource built based on the Vue Nuxt JS technology. It will help you craft a professional technology blog website in little to no time. It provides you with 6 unique layouts of different types. Also, it comes with 3 Header Styles, 15+ Sections and 2+ Footer styles, etc. Mitech has an elegant-looking design coupled with tons of features that give you unlimited possibilities when creating a sophisticated website. Some of the cool features in this template include Dynamic Blog, Clean Code, Font Awesome Icons, Cross Browser Support, Well Documentation, and so on.
All these specialties are available at a regular license fee of 24 USD only.
Castro – Vue JS Construction Template
Building a dedicated Vue JS-based construction web template happens quicker with the right template. In this regard, Castro would be the right choice. Instead of doing all the work from square one, you can expedite the process of your construction website creation with this unique construction VUE JS template. It is a remarkable tool with a horde of treats that will do you really well. Some notable amenities you will find in this template include Vue CLI, Vue Router, Webpack & Babel, Valid HTML5 / CSS3, 1000+ icon font, W3C Validated Code, Cross Browser Support, Speed Optimized, and so on.
You can purchase this unique construction Vue JS template at a regular license fee of just 24 USD.
Clean UI Vue Pro — Multi-Concept Admin Template
Clean UI Vue Pro is a 100% responsive multi-purpose admin dashboard VueJS template. It is a multi-concept template that comes packed with many essential features. Some of its features include 50+ pages, 80+ UI features, Bootstrap, Ant Design UI Kits, 70+ useful components, detailed documentation, solid extendable architecture, 24/7 premium support, compatible with electron and cordova, VUEX store, firebase authorization, code splitting, dynamic import, CSS Modules plugin, Performance optimizations, 3 icon packs, light and dark templates, layout settings, cross-browser support, etc.
All these wonderful features of Clean UI Vue Pro comes with a regular license fee of just USD 24.
Sofbox – Vue JS Software Landing Page
Sofbox is a VueJS template. It comes packed with multiple features. Some of those features include 100% responsive modular design, detailed documentation, easy to customize, clean code, awesome sections, cross-browser support, component base, Vue Router, hover effects, Google Maps, Retina Ready, Sticky Menus, 8+ home page layouts, 5+ header styles, SSR and SPA support, Free Google Fonts, etc.
All these features of Sofbox VueJS template come with a regular license fee of just USD 19.
Tovo – Vue JS App Landing Page
Tovo is a VueJS Template. It has a modern and clean design which is most suitable for making any kind of app landing page. Tovo comes packed with many essential features. Some of its features include 100% responsive design, 3 different home page layout, 3 pre-built color presets, Google Font, Free icons, pixel perfect design, Vue bootstrap framework, unique design, detailed documentation, etc.
All these great features of Tovo comes with a regular license fee of just USD 24.
Chatloop – Vue JS App Landing Page
Chatloop is a VueJS template. It is one of the best app landing page templates which has a unique and beautiful design. It comes packed with many essential features. Some of its features include Vue Bootstrap Framework, webpack, and babel, Google web fonts, pixel perfect design, Free icons, 100% responsive design, easy customization, valid HTML5/CSS3, etc.
Chatloop VueJS template comes with a regular license fee of just USD 21.
Skote – Vuejs Admin & Dashboard Template
Skote is a VueJS template. Skote is an admin dashboard template that has a clean and minimal design. It comes with multiple features. Some of its features include dark and light versions, RTL options, Firebase authentication, multiple layouts, 100% responsive layout, clean and well-commented code, W3C validated code, 3 different types of charts, E-commerce product, orders, customers, cart, checkout, shops, and pages, etc.
All these features of Skote VueJS template come with a regular license fee of just USD 24.
Vue Js Landing Pages
Orbiter – Bootstrap + Laravel + Vue Minimal & Clean Admin Template
Orbiter is a VueJS template. It is based on the latest bootstrap version and the latest laravel version. It comes packed with multiple features. Some of its features include 100% responsive design, multi-purpose use, UI Kits, creative widgets, useful plugins, authentication pages, 7+ Icons sets, 100+ pages, 3+ unique dashboard layouts, vertical layout, horizontal layouts, easy customization, clean code, detailed documentation, W3C validation, cross-browser support, etc.
All these features of Orbiter VueJS template come with a regular license fee of just USD 14.
Dexam – Vuejs + Html SaaS, Startup & Product Landing Page
Dexam is a VueJS Template. It is a multi-purpose template most suitable for making a product landing/showcase page. It comes with many essential features. Some of its features include 100% responsive and clean design, contact form section, 11 different and unique demos, pricing sections, product features section, team section, FAQ section, 2 blog section, 2 testimonial section, 2 features section, 2 work section, 2 service section, Intro section with 10 variations, blog section with 2 variations, 20+ color variations, etc.
All these features of Dexam come with a regular license fee of just USD 9.
Gull – Vuejs & HTML Admin Dashboard Template
Gull is a next-generation VueJS template. It is an admin dashboard template that comes with multiple essential features. Some of its features include 4 dashboard versions, dark and light versions, 100% responsive design, 200+ card widgets, custom loading buttons, form wizard, custom switch, radio and checkboxes, modal dialog, detailed online documentation, 2000+ premium icons, multi-lingual support, etc.
Gull with its wonderful features comes with a regular license fee of just USD 18.
Ubold – Admin & Dashboard Template
Ubold is a VueJS template. It comes with multiple features. Some of its features include 100% responsive design, detailed documentation, 1800+ pages, 500+ UI Components, 110+ charts, 6+ built-in apps, RTL & LTR support, 3000+ font icons, error pages, CRM and eCommerce applications, etc.
Ubold is a wonderful VueJS template that comes with a regular license fee of just USD 29.
Shreyu – Admin & Dashboard, Angular, React, Vue and Laravel
Shreyu is a VueJS template. It is an admin and dashboard template that helps to build a modern web application and includes Sass based interface, custom admin panels, dashboard, CRM, CMS, e-commerce panel, etc.
It also comes with many other features. Some of its features include Icons, Reusable widgets, apex charts, form wizards, advanced data tables, WYSIWYG editors, form wizards, easy development and customization, multiple navigations with extensive use of SCSS variables, etc.
Shreyu comes with a regular license fee of just USD 26.
Piaf – Vuejs Admin Template
Piaf is a VueJS template. It is an awesome admin template that comes with a lot of features. Some of its features include right-click menu, multi-language support, keyboard shortcuts, two panels menu, Icons mind Webfont, 10 color schemes, 4 dashboards, lots of components, 3 applications – survey, chat and todo, RTL support, video player, advanced validations, lightbox, etc.
All these wonderful features of Piaf comes with a regular license fee of just USD 28.
Multikart – Responsive Vuejs eCommerce Template
Multikart is a multipurpose eCommerce VueJS template. It is specially designed for making websites of online shops which sell a variety of products ranging from bags, mobile phones, fashion accessories, shoes, etc.
It comes packed with multiple features. Some of its features include SSR support, payment gateway option, Vue Validation, custom pagination, one-page checkout, Vue awesome slider, cart variations, advanced vue image gallery, font awesome & themify icons, color swatches, firebase authentication, PayPal and stripe payment gateway, 100% responsive design, blog pages, etc.
Multikart VueJS template comes with a regular license fee of just USD 32.
Clear – VueJS + Laravel Admin Template
Clear is a VueJS template. This admin template comes with 2 color variations and 5+ layout designs. It also has many other features. Some of its features include 100% responsive design, numerous charts, forms, widgets, calendar, Google fonts, Bootstrap, CSS3, 70+ pages, 4 icon families of 2000+ icons, etc.
Clear VueJS template comes with a regular license fee of just USD 25.
Endless – Vuejs Admin Template
Endless is a VueJS template. This admin template comes with many features and functionalities. It is one of the best admin templates for making your dream application.
Some of its features include smooth customizer, multiple color options, firebase integration, firebase todo integration, firebase crud integration, RTL support, detailed documentation, Google Fonts, 100% responsive layout, clean and well-commented codes, animated gallery, W3C validated code, form wizards, light and dark modes, feather icon, quick search, etc.
All these wonderful features of Endless VueJS template come with a regular license fee of just USD 16.
VueJS Laravel Admin Template
VueJS laravel admin template is built on VueJS, Laravel, and Bootstrap. It comes with multiple features. Some of its features include 7 different layout options, multiple breadcrumb designs, multiple color schemes, detailed documentation, regular updates, fixed menu, centered logo, fixed header, boxed layout, no header, light, and semi-dark versions, etc.
All these features of the VueJS laravel admin template come with a regular license fee of just USD 25.
Vuejs Landing Page Github
Material Design Admin Web App and HTML Template
Material Design is a VueJS admin template. It is a multipurpose template. It comes with many features. Some of its features include Redux store management, React Route V4 integration, SCSS preprocessor for CSS, 13 different colors, 500+ components, lifetime updates, customer support, 6 single page portfolio, Material design with react, material design with angular 4, 12 different color demos, 100+ UI layouts, flexible layout with flexbox, 20+ JS plugins, 3 different home page versions, etc.
All these features of Material Design come with a regular license fee of just USD 20.
DirectView – Directory & Listings Vuejs Site Template
DirectView is a VueJS template. It is specially designed to make any type of directory or listing website. It comes with multiple features. Some of its features include 100% responsive design, admin panel, Google map, listing reviews, 2000+ Icons, Multiple listing list styles, private messages, etc.
All these wonderful features of DirectView VueJS template comes with a regular license fee of just USD 18.
Vuejs Home Page
Veltrix – Vuejs Admin & Dashboard Template
Veltrix is a VueJS template. This is one of the best admin and dashboard templates. It comes with many features. Some of its features include light and dark version, W3C validated code, 3 different types of charts, 100% responsive design, Font Icons, multiple layouts, RTL support, Data Tables, Free lifetime updates, SASS integration, Firebase authentication, etc.
Veltrix VueJS template comes with a regular license of just USD 24.
Sphinx – Vuejs Material Design Admin Template
Sphinx is a VueJS template. Sphinx is built using modern workflow technologies and tools. It comes with many features. Some of its features include material design concept, clean and elegant design, 100% responsive layout, login/signup page, user profile, mailbox, dashboard, steppers, time pickers, date pickers, dialogs, carousels, avatars, badges, sliders, material cards, Vue-router, Vuex, etc.
All these features of Sphinx VueJS template come with a regular license fee of just USD 26.
Pragmatic – Vue.js Admin Template
Pragmatic is a VueJS template. It comes with many features. Some of its features include 70+ layout combinations, collapsed menu, 80+ page templates, multi-lingual support, 100% responsive layout, crypto dashboard, calendar design, 2000+ font icons, 8 color schemes, 100-page templates, RTL support, light and dark color schemes, SCSS base css, CSS variables, detailed documentation, built-in apps, etc.
All these great features of Pragmatic comes with a regular license fee of just USD 24.
Dorsin – VueJs Landing Page Template
Dorsin is a VueJS template. It is a landing page template that comes with 9 different home page layouts, authentication pages, unlimited color options, and many other features. It is a multipurpose template perfect for a variety of websites including showcase websites, personal or startup websites, agency websites, app product launch websites, etc.
It also has many other features. Some of its features include Font icons, Google fonts, easy customization, clean code, modern design, etc.
It comes with a regular license fee of just USD 19.
Ignity Admin – Bootstrap 4 Vuex Nuxt Dashboard Template
Ignity admin is a VueJS template. It comes with some advanced features. Some of those features include easy component writing Vue, universal code run on server and client, automatic code-splitting, SEO friendly, working authentication, Real database apps, powerful auto-routing, detailed documentation of source code, minify your JS or CSS, the color scheme for the entire project in one file, dual-tone responsive icons, extendable with a modular architecture, real-time changes in development, connect to any backend, 10+ dashboard layouts, etc.
Ignity Admin VueJS template comes with a regular license fee of just USD 29.