Archive

Archive for January, 2017

7 design predictions for 2017, that might actually happen

January 10th, 2017 No comments

Every year, blogs like this one try to predict what’s going to happen in our industry over the next 12 months. Design is a product of its environment and good design reflects the world that it exists in; no one has a crystal ball, so unsurprisingly design predictions are wrong as often as they are right.

However, there are clear emerging trends on the web. Sometimes we see developments happen in front of us. Sometimes they keep coming up in conversation. Sometimes one solid idea unites a set of related trends. More often than not, we’re just following the age-old pattern of revolution and counter-revolution.

Here are seven developments I think we’ll see this year, together with a score on how confident I am that I’m right…

1. 2017 will not be the year of VR

VR is amazing. The ability to disconnect from your context and immerse yourself in a more flexible reality is genuinely world-changing. What’s more, the technology is finally mature enough to deliver on its promise. But VR will not be a mainstay of web design in the next 12 months.

The common objection to VR is the cost of the kit, but actually a VR headset is relatively cheap. A smartphone costs in the region of $850 (and only lasts a month less than the contract you sign to get it) and the mobile web is still growing at pace. (What’s more, you can use that self-same smartphone and some cardboard to create a rudimentary VR setup.)

Most people are too lazy to put on a VR headset just to order pizza

What’s holding up VR is our laziness. If you look at your web stats, you’ll see that most mobile browsing occurs via wifi; in other words, we’re browsing the web on portable devices when we’re not mobile. We know that we’ll get a better experience on desktop, but the desk is all the way over there, and my phone’s already on, and it’s in my pocket…

The biggest challenge to VR is that it can’t be used casually. VR is an event, an experience. Most people are too lazy to put on a VR headset just to order pizza. So we’ll play games, watch movies, tour vacation spots, but we won’t browse Vice, or flick through Facebook, or just kill time. Until we do, VR will always be a supplementary technology.

Confidence: 8/10

2. We’ll be obsessed with security, but forget passwords

For many people, 2016 was a bit of a gut-punch, and there’s inevitable fallout from that. In industry terms, it doesn’t actually matter if Russian hackers put Trump in the Whitehouse, what matters is that the issues of hacking, privacy, and security have entered the public consciousness.

It’s very likely that over the next 12 months we’ll see an increase in the use of browsers like Vivaldi. It’s very likely that many more sites will be using SSL certificates. It’s very likely that every client you meet this year is going to have at least some questions about security.

One potential benefit of our renewed obsession with privacy is the end of passwords. Passwords have never been secure, because humans aren’t good at remembering long strings of random characters, and computers are. Passwords have always been a least-worst solution. The last few years have seen numerous attempts to move beyond them, ranging from master password applications, to social media sign-ins, to email-based logins. Finally, we have a great alternative in the form of fingerprint ID.

In 2017, the option to sign into sites using your fingerprint will become commonplace. The ubiquitous nature of mobile devices, and the steady decline of desktop browsing, coupled with the obvious benefits of a unique identifier that you don’t need to remember, will be the tipping point for simple security on the web.

Confidence: 6/10

3. Someone will finally make AI work

Obviously it won’t pass the Turing test, it won’t even try to. But provided that the marketing department agrees to call it “AI”, then machine learning and pattern recognition will make 2017 year zero for widespread artificial intelligence.

it’s a short hop from A/B testing, to collaborative A/B testing where results from multiple sites are pooled into a single AI

At the core of this AI revolution, will be an enhanced approach to A/B testing; A/B testing only produces reliable results when you have many thousands of sessions to gather feedback from—more than most sites can muster. With the continued growth of design patterns, and the acceptance of design convergence over the last couple of years, countless designers are working with comparable UI elements. All of which means it’s a short hop from A/B testing, to collaborative A/B testing where results from multiple sites are pooled into a single AI. Complex design problems can then be solved using feedback from millions of users across thousands of sites.

In 2017 someone will release a cloud-based solution that will gather data from across the web, and interpret it intelligently so users can design from an informed point of view. This process won’t replace designers, because insights will, by necessity, be broad and work on a design pattern level. How to implement those insights will be a key talent for designers over the next decade.

Confidence: 3/10

4. The death of the web(site) and an end to online advertising

Designing sites as component-based systems, rather than as individual pages has been a popular approach for a number of years. The latest formalised version of the approach is Brad Frost’s Atomic Design. The value this methodology brings is an increased flexibility, greater consistency, and a more responsive approach across different media.

In 2017 we’ll take the next step by detaching components from sites, and delivering content as brands, rather than distinct websites. A travel service for example, might have hotel listings, flight listings, venue reviews, currency conversion, weather reports, all displayed in a single browser window, and all syndicated from different content providers. We’ll effectively be browsing as we do now using multiple tabs, but on a single screen.

Initially these services will be web apps, eventually we may see them evolve into distinct browser-like applications.

The side-effect of this new approach to syndication will be the final nail in the coffin of the floundering advertising revenue model. Advertising has always been a flawed method for funding the web: adverts are intrusive, unpopular, and impact content.

There are now two distinct webs forming, the traditional web that is locked in to single providers, and a SaaS model in which micro-payments buy access to select content. As 2017 progresses we’ll see the growth of the payment model, not in the form of paywalls, but in tiny micro-payments, enabled in the browser, that pay for syndicated content as we consume it.

Confidence: 2/10

5. The web will be beautiful

Utilitarian design has been the de facto approach for five years or more. We talk about design being “invisible”, as if a user being aware of design is somehow harmful.

Through 2016 there was an increasing interest in “delightful” design. Companies like WeTransfer enhanced their value with conspicuous design. Leading design thinkers like Stefan Sagmeister were advocating for beauty. The austerity of flat design has already been supplanted by a rediscovered love of gradients.

A reaction against the over-reliance on frameworks has lead to designers exploring more expressive ways of communicating

As human beings we’re attracted to beauty. If a product is beautiful, the experience of using it is more enjoyable. A product that is enjoyable, will be used more.

The drive for beauty is tied up in a number of ongoing trends. A reaction against the over-reliance on frameworks has lead to designers exploring more expressive ways of communicating. Hand-lettering and illustration are amongst the most in-demand design skills.

Even a clunky 2017-style AI can follow a set of rules to make type legible, to make colors inclusive, to make layouts responsive; those skills have all been mastered. In 2017, each designer’s strength will be their own craft skill, a unique vision of what is beautiful.

Confidence: 9/10

6. Design tools will explode

It’s a common misconception that there are a lot of design tools available. In actuality, there are a few key areas that receive all the attention, while the bulk of our processes are under-served. If you need a color picker, you have almost too much choice. If you’re looking for a prototyping tool there are a dozen or more professional-grade options available. If on the other hand you’re looking at vector graphics, you realistically have three options. For Bitmap artwork, it’s more like two.

There is clearly an appetite for new solutions to new problems. Web professionals, by our nature, are the first to dive into new technology. We think nothing of working with applications that are still in beta. The growth of prototyping tools demonstrates that there’s also a generation of software developers out there, ready to create innovative, exciting, and affordable design applications.

At the very least, in-app tooling will dramatically evolve this year. Adobe is reportedly working on AI additions to Creative Cloud as it tries to re-establish its dominance in the market, and it’s likely that other major players will follow suit.

Automation is the key word for software in 2017, and it will all be aimed at freeing up your time for more creativity.

Confidence: 7/10

7. The unstoppable rise of VX Design

Right now, someone somewhere is writing a Medium post in which they coin the latest industry buzz word. It’s probably very similar to “UX” only more-so. It’s probably “VX”; “VX” is one step along the alphabet, and still includes the cool sounding “X”. “VX” could be a reference to “VR”, it probably stands for “Virtual Experience”.

The term “VX Designer” will be virtually meaningless, but eight out of ten designers will be using it on their social media profiles by December. Several new design blogs will pop up, dedicated to “All things VX”. At this year’s MAX, Adobe will announce a specialist version of Creative Cloud, targeting “VX Designers”.

By the end of the year we’ll all be pontificating on “VX” as the only legitimate approach to design in 2018.

Confidence: 10/10

800+ Creative and Professional Illustrator Brushes – only $24!

Source

Categories: Designing, Others Tags:

A Thing To Know about Gradients and “Transparent Black”

January 10th, 2017 No comments

Say you have a gradient in CSS that goes from red to transparent. Easy, right? Like this:

.element {
  background: linear-gradient(
    to bottom,
    red, 
    transparent
  );
}

There is a pretty big gotcha here, though.

In Chrome (also Android), Firefox, and Edge, you’d be all good.

But in Safari (also iOS), you’d not be good.

The element on the left in each browser demonstrates the problem.

The problem, the best I understand it, is that transparent is being interpreted (and interpolated) as “transparent black”.

To fix it, you have to set the color as a fully transparent version of that exact color. Like:

.element {
  background: linear-gradient(
    to bottom,
    red,
    rgba(255, 0, 0, 0)
  )
}

That’s not always easy with a hex code, since it’s not obvious what the RGBa or HSLa equivalent is. It’s not hard to find a color converter though, just web search around.

The CSS Level 4 color() function will make this easier, Like:

.element {
  background: linear-gradient(
    to bottom,
    #eb8fa9,
    color(#eb8fa9 alpha(0%)) /* or is it color-mod()? */
  )
}

But the support for that isn’t around yet.

Sass can help out, if you are using that:

.element {
  background: linear-gradient(
    to bottom,
    #eb8fa9,
    rgba(#eb8fa9, 0);
  )
}

A Thing To Know about Gradients and “Transparent Black” is a post from CSS-Tricks

Categories: Designing, Others Tags:

Super Deal: Mega Snow & Winter Bundle from Feingold Design – only $11!

January 10th, 2017 No comments

This bundle contains 9 high-quality design products for your perfect winter time. Simulating photorealistic snow or fog for photography, web or print design has never been that easy. Various snow objects as well as 16 artistic snowflakes with transparent backgrounds will add a special touch to your Christmas and winter designs. The pack of winter photos and a frozen text effect rounds everything up, and is perfect for social media posts, bloggers or web shop owners.

Highlights:

  • Real Snow Brushes for Photoshop CS1+: This high resolution brush for Photoshop was created to paint falling and lying snow or photorealistic frozen effects. The snow flakes were cut out of real photographic material and can be used to create quite realistic snowscapes.
  • Real Snow Photo Overlays for Photoshop CS4+: Just drag one of the 4 different snow-layer folders on top of your photo. Each of the 4 preconfigured overlays consist of 8 different layers to control the amount and depth of snow.
  • Fog Effect for Photoshop CS4+: Realistic and lossless high quality fog effect prepared to fit for portrait, landscape, architecture or panorama photos. Easy to apply, just drag & drop the adjustment layer folder on top of your photo.
  • Frozen Text Effect for Photoshop CS4+:The Photoshop document provides simple adjustment settings for text layers to create frozen looking text. The effect is prepared for dark and bright backgrounds and comes fine-tuned in 7 different sizes (6pt to 180pt).
  • Snow Line Elements and Icicles : 27 photographic high-resolution snow line elements. Perfect to add more realistic snow to your web design, poster, greeting- or post card layouts. Cut out and prepared for easy use. Delivered in transparent PNG-files (38 files).
  • Seamless Snow Texture (1 JPG image file & PS Action): This seamless high-resolution snow texture was made to generate large snow surfaces. One JPG-file, 4717?×?3146 pixel, 300dpi. Including Photoshop Actions to generate large surfaces.
  • Abstract Snowflakes (16 transparent PNG image files): Want something special on your Christmas or business cards? This bundle includes 16 transparent snowflakes you can work with. Each flake is 2000 x 2000 pixel large (about 15 x 15 cm in print at 300 dpi).
  • Abstract Snowflake Generator for Photoshop CS4+: Paint your own individual snowflakes with the help of this PSD-file. You only paint one-twelfth of the snowflake and the Smart Object does the rest for you. Just paint with brushes into the Smart Object to get your 2000 x 2000 pixel snowflakes directly.
  • Winter & Snow Photo Pack (36 JPG image files): 36 winter photos matching a wide variety of snow related topics.

Check all the previews here.

Normally, this mega vector collection sells for $642 but for a limited time only, you can get Mega Snow & Winter Bundle for just $11 – That’s a monstrous savings of 98% off the regular price.Go here to get this awesome deal!

Read More at Super Deal: Mega Snow & Winter Bundle from Feingold Design – only $11!

Categories: Designing, Others Tags:

The Road to SVG and Custom Elements in Clarity Icons

January 10th, 2017 No comments

Another day, another design system deciding an SVG icon system is the way to go.

Everybody has their own set of considerations when making a choice like this. Scott Mathis documents the major considerations for Clarity: Opting-out, sizing, multi-colors, interactivity, scale, and the future. Based on these, they actually ended up on a custom element (, which is inline under the hood), just like Etsy.

Direct Link to ArticlePermalink


The Road to SVG and Custom Elements in Clarity Icons is a post from CSS-Tricks

Categories: Designing, Others Tags:

An Introduction To Building And Sending HTML Email For Web Developers

January 10th, 2017 No comments

HTML email: Two words that, when combined, brings tears to a developer’s eyes. If you’re a web developer, it’s inevitable that coding an email will be a task that gets dropped in your lap at some time in your career, whether you like it or not. Coding HTML email is old school. Think back to 1999, when we called ourselves “webmasters” and used Frontpage, WYSIWYG editors and tables to mark up our websites.

Not much has changed in email design. In fact, it has gotten worse. With the introduction of mobile devices and more and more email clients, we have even more caveats to deal with when building HTML email.

The post An Introduction To Building And Sending HTML Email For Web Developers appeared first on Smashing Magazine.

Categories: Others Tags:

Rapid Growth: Unsplash Turns Into a Company

January 10th, 2017 No comments

Unsplash is one of the world’s fastest growing providers of free photos. This is probably an understatement, even. Unsplash has an unrivaled growth to boost. Now, it is being turned into a business.

Unsplash, From a Handful of Photos to One of the Most Important Photo Providers for Creative People

Readers of Noupe Magazine have known Unsplash since its early days in the year 2013. Back then, the small project was run on Tumblr. The credo was “10 free images every ten days”. The actual hosting of the pictures was mostly done in the Amazon Cloud, and later on, wherever possible. Unsplash was a small side project of the platform Ooomf.com, which changed its name into Crew shortly afterward.

From the beginning, Unsplash has always provided all images for free under the Creative Commons Zero license, which roughly equals the public domain. There were no search or sorting functions, which is why I recommended subscribing to the free newsletter back then. This way you received an email with the 10 free images every 10 days.

Unsplash came like a bombshell. We at Noupe were impressed as well, and from time to time, we covered the new releases in our articles, such as this one.

Hello, Unsplash Inc.

As the founder Mikael Cho told the newsletter recipients in an email these days, Unsplash was able to gain 20,000 newsletter subscribers right off the bat. Within a few months, the number grew to 80,000. The people at Crew noticed that something happened, but they didn’t think it would be as significant as it turned out to be.

The switch to a custom platform with search options made the number of downloads jump from one to ten million photos in no time. A few months later, the 30 million milestone was reached.

The team grew with the project, from one to five people. The number of registered users is somewhere in the millions by now. A billion photo views were counted for the month of November 2016 only. By now, three photos are downloaded from Unsplash every second.

The Rapid Growth of Unsplash. (Source: Crew)

Finally, the inevitable happened. As platforms, Crew and Unsplash have nothing to do with each other. There are no overlaps in terms of content. Nonetheless, the same team was running both services. Small side projects can be handled like this, but a project of Unsplash’s size requires a different approach.

Thus, it was no surprise to me that Crew and Unsplash would separate. Unsplash becomes Unsplash, Inc., and gets equipped with its own team. This way, both companies can focus on their respective product. For now, this does not involve a relocation. Both Crew, and Unsplash will continue to operate from within the Collective & Café Workspace in Montréal.

The email to the newsletter subscribers can be read here.

(Note: The photos in this article were taken from the Unsplash portfolio.)

Categories: Others Tags:

Non-Rectangular Headers

January 9th, 2017 No comments

Jon Moore documents a trend in which designs opt for non-rectangular headers. Slants, rounded bits, image crops, even weird jagged polygons. I mean c’mon, what kinda site would put a weird jagged polygon as a header?

Direct Link to ArticlePermalink


Non-Rectangular Headers is a post from CSS-Tricks

Categories: Designing, Others Tags:

Breaking Out Of The Box: Design Inspiration (January 2017)

January 9th, 2017 No comments

Many people find it difficult to get their minds back into work after a holiday season filled with love, food, and friends. May 2017 bring you a healthy and inspiring adventure. As for that kick-start inspiration, I hope this article will help get you back in the creative mindset.

The above illustration has a style that I’m sure everyone will admire. The combination of colors used is simply marvelous — so simple, yet so complex.

The post Breaking Out Of The Box: Design Inspiration (January 2017) appeared first on Smashing Magazine.

Categories: Others Tags:

What’s new for designers, January 2017

January 9th, 2017 No comments

New design tools are like new toys. You are probably always looking for elements to make your life easier. Here we have them. From new releases to updated documentation to open source code from Kickstarter to a few funky typefaces, this roundup is packed with design goodies.

Almost everything on the list this month is free, with a few high-value paid apps and tools. They’re sure to be useful to designers and developers, from beginners to experts.

If we’ve missed something that you think should have been on the list, let us know in the comments. And if you know of a new app or resource that should be featured next month, tweet it to @carriecousins to be considered!

Bulma

Bulma is a modern CSS framework based around Flexbox. It allows you all the speed of a framework, while still making use of the most up-to-date layout tool available in CSS. Responsive, modular, and free, it’s powerful and lightweight.

Flawless Typography Checklist

Typewolf’s Flawless Typography Checklist is a comprehensive set of rules for web typography. 100 items on the premium list all include a detailed explanation and a helpful visual guide so you know exactly how to design great typography.

Figma

Figma claims to be the first UI design tool with real-time collaboration. Your whole team can work on the same project file at once. It might sound confusing but it’s a great time-saver, it imports from Sketch, and works on Mac and Windows.

Kickstarter App Code

Want to build an iOS or Android app like Kickstarter? It’s possible now as the code for the well-used platform is open source. You can find screenshots, playgrounds and plenty of other goodies on GitHub. There’s a ton of code to help you get started with an app or think about development. Use it as a basis to get started or learning example to help better understand how this type of app comes together.

Rellax

Rellax is a lightweight, vanilla JavaScript library for parallax scrolling. Implement parallax scrolling with a single line, and tweak speed with a single attribute. The self-effacing description of this “quirky” JS code belies how useful it actually is.

MusicForProgramming

Need some help to work through the greyness of January? musicForProgramming’s got your back. It’s a collection of mixes to aid productivity and help you concentrate on coding. Plus it’s got a pleasingly brutalist website.

Material.io

Google has created a whole new website with all the resources you need for a Material Design project. The new home for all things Material Design includes the system at a glance, style rules, branding, interaction and motion principles. There’s also a gallery of examples and a staging environment that will open soon.

Patterninja

Patterninja is a tool that combines images to create patterns. Use your image or the included library to create a variety of pattern types that can be used for web projects or downloaded as high resolution versions for offline work. The tool is super easy to use, and fun to play with.

Atomic Design

Brad Frost’s book Atomic Design is now available as a printed book and online. It details’s Frost’s theories on designing interface systems and provides everything you need to know in order to be an effective UI designer in 2017.

Protopie

Protopie is a new tool for designing mobile interactions without any code. Multiple gestures are supported, as well as smartphone accelerometers and microphones. A timeline is included for fine-tuning interactions, and scenes can be applied to organise your designs.

Smash

Smash is a tool that allows you to view photos and images, videos and documents, from any device without having to download anything. The best thing about the service is that it doesn’t come with the same file-size restrictions of email or other delivery services.

Type Nugget

Type Nugget is a great project that allows you to visually design a typography scheme and then export it for CSS. It generates tidy, usable CSS from a live browser preview, but be aware it’s still in beta, so some features, such as breakpoints and user-created galleries, are still to be added.

Prospero

Prospero is a simple tool to help designers create project proposals. The tool, which is still in beta, was made to help you keep track of proposals with ease. They are also banking on you winning bids; you only have to pay for the service if a proposal is accepted and returned.

Anime.js

anime.js is a lightweight JavaScript library for modern web animation. It works with CSS, transforms, SVG objects, and DOM attributes. Simple to learn and easy to use, it’s a way better option than CSS or JavaScript defaults.

Yoga

Yoga is a cross-platform layout engine that enables collaboration among team members. The tool is used internally at Facebook, which has released the CSS layout to the general public. The layout library is designed to work as a standalone engine. The best part? If you already have an understanding of Flexbox, Yoga will be a breeze. You write code in Java, C#, Objective-C and C.

Coggle

Coggle allows designers or teams can share notes in a visual way quickly and easily. The “mindmap” tool lives in the cloud so you can visualize real-time ideas in-browser from any location.

@colorschemez

Colorschemer is a delightful twitter bot that sends out seemingly random color palette combinations, such as unconcerted deep lilac, haziest ultramarine blue and pyrheliometric periwinkle. The feed has been around for a little while, but with all the focus on bots right now, this one is a great example of best practices. Plus, you might find an amazingly unexpected color grouping.

Drawing Challenge

Take on a drawing challenge. Smashing magazine has a great tutorial for the new year to help you get started with sketching. The challenge will help you better think about problems and solutions from a design standpoint. Further, the exercise is designed to help you better your skills in Adobe Photoshop, Illustrator and After Effects. Refreshing or updating your skills in this software is always a good thing.

Evil Icons

Evil Icons are a free set of SVG icons in a simple line style. Code support for Rails, Sprockets, Node.js, Gulp, Grunt, and CDN is included. Released under the MIT license, we’re not sure what’s so evil about them.

Barking Cat

Barking Cat is a fun novelty typeface that the designer calls “3D crunchy.” The lowercase letters have five different versions that cycle as you type so the design looks more hand-drawn.

Nunito Sans

Nunito Sans is a highly-readable, balanced sans serif that’s available through Google Fonts. The characters have thin, uniform stroke widths that can work for body or display copy.

Merthy

Merthy is an elaborate script typeface with plenty of flourishes. The typeface has a rather feminine feel but can take on additional meaning based on the rest of your design. The demo set of characters is free, with an available download with more options.

Abhaya Libre

Abhaya Libre is a simple set of serif characters that’s Unicode compliant. It’s available through Google Fonts. You might recognize the character set; it is derived from FM Abhaya, which was designed way back in 1996.

Painter

Painter replicates the old-school baseball jersey style typeface with swashy letterforms and plenty of alternates. The thick lettering can make a nice display type style that can work in a number of project types.

Culrs

Culrs is a curated set of colors for use on projects that are curated into specific categories. You can choose hopeful colors, minimalist colors, Japanese colors, and more. Sign up for an account and you can save the sets you like best.

42 Professional Fonts from Mellow Design Lab – only $9!

Source

Categories: Designing, Others Tags:

Build a Custom CMS for a Serverless Static Site Generator

January 9th, 2017 No comments

Static Site Website Generators have been getting increasingly popular within the last 2 years. Much has been written (like this and this) and there have been many great open source projects and even funded companies launched to help you get up and running.

What if I told you that you could build a Static Site Generator with your own custom CMS without the need for a database? Not just that, but we can get to Hello World! in under 100 lines of JavaScript.

The historic problem with static site generators is that they typically require content to be authored in markdown. This works great for developers but not as well for clients who are used to working in a CMS authoring environment. Creating such an environment has traditionally meant the need to create a database to manage authentication, save content and upload media.

Thanks to the rise of so-called serverless architectures (aka Backend as a Service), this is no longer the case.

In this demo, we will create the bare bones of a static site generator with content authored by an admin user via a standard web form (no database necessary).

To accomplish this, we will use:

View the completed files for this proof-of-concept demo project on GitHub.

Set Up a Static Website on Amazon S3

First, sign up for an account with Amazon Web Services (AWS) if you have not already. Once you have an AWS account it is easy to set up a static site hosted on AWS Simple Storage Service (S3).

First, create a bucket and then under Static Website Hosting in Properties, select Enable website hosting and set the Index Document to point to the homepage of the site (`index.html`).

Next, create a bucket policy to make your site publicly readable. For information on setting up bucket permissions, refer to the AWS S3 documentation. Additionally, we need a policy that will allow an admin to save content edits.

<?xml version="1.0" encoding="UTF-8"?>
  <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
      <AllowedOrigin>*</AllowedOrigin>
      <AllowedMethod>POST</AllowedMethod>
      <AllowedMethod>GET</AllowedMethod>
      <AllowedMethod>PUT</AllowedMethod>
      <AllowedMethod>DELETE</AllowedMethod>
      <AllowedMethod>HEAD</AllowedMethod>
      <AllowedHeader>*</AllowedHeader>
    </CORSRule>
  </CORSConfiguration>

For more detailed information on how to host a static site on S3, including on one of your own domains, refer to Hosting a Static Website on Amazon Web Services.

Create Static Site Files

Create a new directory for your project. Construct a simple project page or pick a simple example from your front end framework of choice. In our demo, we use the Jumbotron example from Bootstrap.

Upload the files to the S3 bucket you created. Once the upload is complete, select the S3 bucket and view Properties. Click on the endpoint link and you will be able to view your site.

Create Admin Login

Amazon Cognito provides a simple way to add an authentication flow to a website.

The first step in this process is to create a UserPool. In the AWS Console, navigate to Amazon Cognito and create a user pool with the default settings. Read more about User Pools in the AWS Documentation.

Once your User Pool is created, you need to add an app with access to the pool. Select your User Pool to edit it, then select the Apps tab. Click the Add an app button and give your app a name. When adding an app, it is very important to uncheck the Generate client secret checkbox because the JavaScript in the Browser SDK does not support apps with a client secret.

We will directly create our admin users in the AWS Console, then provide them with credentials they can use to log in. Only these users will be able to get authenticated to have access to generate the static content for our site.

Go into the User Pool and select Users and Groups. Fill in your own information so you can be the first admin user. Select the option to send an invitation to the user via email.

Now we need to create a login page for our admins. Make a new admin directory in the project with an index.html with a login form inside it. In our demo, we use the Bootstrap Sign In Page.

To connect our form with Cognito, we will need to use the Amazon Cognito Identity SDK for JavaScript. Follow the installation instructions on the project page to add the scripts to our login page.

Next, use the Amazon Cognito Identity service to authenticate and establish a session for our admin user with the temporary password received via email.

Add a submit event listener to our login form that calls a login function based on the authentication example from the Amazon Cognito Identity SDK for JavaScript Project Page.

$('.form-signin').on('submit', function(e) {

  e.preventDefault();

  var authenticationData = {
    Username : $('#inputUsername').val(),
    Password : $('#inputPassword').val()
  };
  var authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
  var poolData = { 
    UserPoolId : '...', // your user pool id here
    ClientId : '...' // your client id here
  };
  var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
  var userData = {
    Username : $('#inputUsername').val(),
    Pool : userPool
  };

  cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
  cognitoUser.authenticateUser(authenticationDetails, {
    newPasswordRequired: function(userAttributes, requiredAttributes) {
      $('#form-password').removeAttr('hidden');
      $('#form-login').css('display', 'none');
      if ($('#inputNewPassword').val() !== '') {
        cognitoUser.completeNewPasswordChallenge($('#inputNewPassword').val(), [], this);
      }
    },
    onSuccess: function (result) {
      AWS.config.credentials = new AWS.CognitoIdentityCredentials({
        IdentityPoolId : 'us-east-1:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
        Logins : {
          'cognito-idp.us-east-1.amazonaws.com/us-east-1_XXXXXXXXX' : result.getIdToken().getJwtToken()
        }
      });
      $.getJSON('index.json', function(data) {
        $('.container').html($('#adminForm').render(data));
      }).fail(function() {
        $('.container').html($('#adminForm').render({}));
      });
      AWS.config.update({
        region: 'us-east-1',
        credentials: new AWS.CognitoIdentityCredentials({
          IdentityPoolId: 'us-east-1:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
          Logins: {
            'cognito-idp.us-east-1.amazonaws.com/us-east-1_XXXXXXXXX' : result.getIdToken().getJwtToken()
          }
        })
      });
      s3 = new AWS.S3({
        apiVersion: '2006-03-01',
        params: {
          Bucket: YOUR_BUCKET_NAME
        }
      )};
    },
    onFailure: function(err) {
      alert(err);
    }
  });
});

We need to create an additional form to allow the admin to create a password. Admin will sign in with their temporary password then set a new password to complete authentication.

For more information on working with Amazon Cognito and User Pools, refer to these articles:

Create CMS Admin

With login complete, we want to allow our admin to edit content on the site. In this demo, we will edit the top jumbotron callout. After admin is authenticated, we display a form with inputs for site info, the callout headline, and text content.

When the form is submitted, we combine the data from the form with a template to generate static HTML. In this demo, we JSRender as our templating engine.

Create the template for our Jumbotron page by copying the HTML and embed it on our admin page as a JSX template. Replace the content with template tags mapped to the names of the admin edit form fields.

<script type="text/x-jsrender" id="jumbotronTemplate">
  <html lang="en">

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="{{>siteDescription}}">
    <meta name="author" content="">
    <title>{{>siteTitle}}</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/jumbotron.css" rel="stylesheet">
  </head>

  <body>
    <nav class="navbar navbar-static-top navbar-dark bg-inverse">
      <a class="navbar-brand" href="#">{{>siteTitle}}</a>
      <ul class="nav navbar-nav">
        <li class="nav-item active">
          <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">About</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="#">Contact</a>
        </li>
      </ul>
    </nav>
    <div class="jumbotron">
      <div class="container">
        <h1 class="display-3">{{>calloutHeadline}}</h1>
        <p>{{>calloutText}}</p>
        <p>
          <a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a>
        </p>
      </div>
    </div>

    ...

Add an event listener to the edit form to capture the data entered as a JSON Object, then pass it to the JSRender template to generate HTML for uploading to S3 in the next step.

$('.container')
  .on('submit', '#form-admin',function(e) {
    e.preventDefault();
    var formData = {};
    var $formFields = $('#form-admin').find('input, textarea, select').not(':input[type=button],:input[type=submit],:input[type=reset]');
    $formFields.each(function() {
      formData[$(this).attr('name')] = $(this).val();
    });
    
    var jumbotronHTML = '<!DOCTYPE html>' + $('#jumbotronTemplate').render(formData);
    var file = new File([jumbotronHTML], 'index.html', {type: "text/html", lastModified: new Date()});
    ...

Save Static Site Files

Next, we grant permission to admin to save edits to S3 by creating an Identity and Access Management (IAM) role with a read/write policy for our S3 bucket.

Navigate to IAM in the AWS Console, and then select Policies. Create a new policy with the following Policy Document:

{ 
  "Version": "2012-10-17", 
  "Statement": [ { 
    "Effect": "Allow", 
    "Action": [ "s3:*" ], 
    "Resource": [ "arn:aws:s3:::BUCKET_NAME/*" ] 
  } ] 
}

Next select Roles, then create a new role and give it a name. Select Role for Identity Provider access then select Grant access to web identity providers. Use the default Policy Document for Verify Role Trust.

On the next step, attach the policy you just created for accessing the S3 bucket.

Once again select the Roles tab within the IAM section of the AWS Console. Select the role you just created. In Permissions, under Managed Policies you should see your policy for S3. If you do not, attach it now.

Update the AWS config settings on the admin page to include our S3 service.

// Instantiate AWS SDK service objects now that the credentials have been updated. 
AWS.config.update({ 
  region: 'BUCKET_REGION', 
  credentials: new AWS.CognitoIdentityCredentials({ 
    IdentityPoolId: 'IDENTITY_POOL_ID' 
  }) 
}); 
s3 = new AWS.S3({ 
  apiVersion: '2006-03-01', params: {Bucket: 'BUCKET_NAME'} 
});

The last step for connecting our admin user to S3 is to create an Identity Pool. Return to Amazon Cognito in the AWS Console and click the Manage Federated Identitites button, then the Create new identity pool button.

Give your pool a name then expand the Authentication providers section. Select the Amazon Cognito tab and enter your User Pool ID and App Client ID.

As you can see, in addition to Amazon Cognito you can use other authentication providers such as Facebook and Google. For more information, read Integrating User Pools with Amazon Cognito Identity.

Continue through the rest of the steps then under Sample Code, take note of the Identity Pool Id. Back on our admin page, when our form is submitted we will upload our HTML file to S3.

Additionally, once the HTML file has successfully uploaded, we create and upload a JSON file to store our data so when we return to the form it has the newly updated values filled in.

var file = new File([jumbotronHTML], 'index.html', { type: "text/html", lastModified: new Date() });
s3.upload({
  Key: 'index.html',
  Body: file,
  ACL: 'public-read',
  ContentDisposition: 'inline',
  ContentType: 'text/html'
}, function(err, data) {
  if (err) {
    return alert('There was an error: ', err.message);
  }
  file = new File([JSON.stringify(formData)], 'index.json');
  s3.upload({
    Key: 'admin/index.json',
    Body: file,
    ACL: 'public-read'
  }, function(err, data) {
    if (err) {
      return alert('There was an error: ', err.message);
    }
    $('#form-admin')
      .remove('#success')
      .prepend('<p id="success">Update successful! View Website</p>');
  });
});

Update Cognito’s authenticateUser onSuccess event handler to render the form as a template with values from the JSON file if it exists.

$.getJSON('index.json', function(data) {
  $('.container').html($('#adminForm').render(data));
}).fail(function() {
  $('.container').html($('#adminForm').render({}));
});

Next Steps

  • Given the ability to generate and save static content to S3, there are many exciting possibilities for web content and admin interfaces that can be built.
  • Add image and file uploading capabilities
  • Add a rich text editor
  • Improve the login functionality by adding forgot password and MFA.
  • Build out the admin to edit components and content across multiple pages.
  • Use contenteditable to allow logged in admins to do in-page editing.
  • Manage different user permissions levels with User Pool groups.
  • Develop a workflow for building a custom CMS for each of your client projects.
  • Create your own content management platform.

Build a Custom CMS for a Serverless Static Site Generator is a post from CSS-Tricks

Categories: Designing, Others Tags: