Home » Development » CSS » Seite 8
The AMP (Accelerated Mobile Pages Project) plugin for WordPress is still pretty young and under heavy development.
There are little things that can help to fix current validation problems. I have a couple of fresh AMP pages, that are already indexed by Google.
The currently registered Microformats template (schema.org-NewsArticle) requires an image.
The AMP-WP documentation explains how to add a featured image to your pages (documentation).
I extended that a bit, to link a default attachment image, I uploaded before. This needs to be added to your themes functions.php.
Next we adjust the Microformats definition. This needs to be added to your themes functions.php.
Read the AMP-WP documentation first :) This forces AMP-WP to override the core template with your own. Use the default template as a reference.
Normally the core sanitizer should take care of that. I am sure a filter will be added in the future. For now, this is a quick workaround. You can use a RegExp or DOMDocument to alter the amp-content in your custom template and filter things that break validation.
I am using phpQuery for now, as it allows me to add quick fixes. DOMNode or QueryPath works nicely as well :) Will be looking at the core sanitizer and options later this week. All of this is currently added to the custom template.
Finally output the fixed content as HTML.
The above examples need to be tweaked to your specific content requirements.
The custom template „post_amp_content“ before:
The custom template „post_amp_content“ after:
From the AMP specification :“Note, that AMP document may also be linked to directly…“
This is being added to the custom template as well.
You can find a simple pure PHP highlighter here. Not perfect, but a start. Don not forget to include the CSS :)
I will extend on this as new validation errors or tweaks come up. The core sanitizer of AMP-WP still needs some work and should allow us to do some of the above directly, when the content is parsed / converted for AMP.
Make Syntax Highlighting work in AMP-WP using GeSHi
Time to get AMP ready
Google’s AMP is here to save us from slow mobile content delivery, by enforcing strict standards and limiting what is allowed within AMP pages. The pages only allow a subset of tags and introduce their own tags for fast prefetching of content (images, videos … AMP Specs)
„The Accelerated Mobile Pages (“AMP”) Project is an open source initiative that came out of discussions between publishers and technology companies about the need to improve the entire mobile content ecosystem for everyone – publishers, consumer platforms, creators, and users.
Today, the expectation is that content should load super fast and be easy to explore. The reality is that content can take several seconds to load, or, because the user abandons the slow page, never fully loads at all. Accelerated Mobile Pages are web pages designed to load instantaneously – they are a step towards a better mobile web for all.“
AMP pages are cached within the AMP Cache, providing even faster delivery of your content. The core libs validate your implementation and highlight any problems by pushing errors to the console.
The documentation lists all components currently supported within a page and experimental components in development as well.
I have already added AMP support to our blog posts:
Google’s Webmaster Tools also integrates a new section for AMP, to see how they perform.
AMP is not supposed to replace your webpage, but offer a faster access point to presented content. It will not solve all use cases, but offer better performance for your simple reading pleasure for now. Its a start and lets see how it evolves ;)
Simple way to do some Visual Composer Grid cleanup, when you are using Bootstrap within your theme. This removes and cleans up classes.
Visual Composer for WordPress
Bootstrap / Bootstrap Sass
TimeCircles is a countdown / timer plugin. The plugin provides a huge amount of options to optimize the look to your individual needs.
„gridstack.js is a jQuery plugin for widget layouts. It allows you to build draggable responsive bootstrap v3 friendly layouts. “
Demo @ Github
As I mentioned the usage of Markdown for the Slate documentation builder, here some Markdown editors:
Highly customizable editor.
Use it anywhere and sync to dropbox if you like.
Nice split-screen setup, that shows you how the html conversion looks like.
A nice minimal editor that was developed for Elementary OS.
Alertify.js is a small library which provides light-weight, high performance browser dialogs.
PNotify @ GitHub
Bootcards @ Github
I almost completely switched to Sass in the past year. So organzing my CSS code has become a mission of mine :)
Structure is especially needed, when you are not the only one working on the design. So that everyone on the team can easily understand and contribute with ease. There are never too many files, as files get combined anyway.
Make your own life easier and for those you work with!
Currently applying the following structure on newer projects:
Which architecture fits your project & team will vary.