SlideShare uma empresa Scribd logo
1 de 65
Baixar para ler offline
…there was a time before
WordPress
One file per page
Assemble pages by including
common components
Mix in data from other sources
Emerging trends
• DRY
• Eliminate duplicate content
• Separate concerns
• Improve productivity
Thanks PHP
They matter too
But what about the content authors?
Content is a first class citizen
Further separation of concerns
• Users enter content using a GUI
• Programmers create templates that utilize the user-entered content
• Web pages generated on demand
Sounds simple?
It’s not
• With (pretty much) any CMS:
• Wrangling together templates and data is complicated
• The process is demanding and involves needless work
Most CMS-based websites
Writes ReadsExpensiveModerate
Some CMS-based websites
Writes ReadsCheapModerate
Thanks caching!
“The stack” stacks up
HTTP Accelerator (Varnish)
Web Server (Apache)
Application Server (WordPress/PHP)
Database (MySQL)
Object Cache
(MemCached)
File System
Too far?
Do you build a solution for your
problem or do you fit your problem
into a solution?
Build a solution
• We have the tools:
• Static site generators
• Rapid application frameworks
• APIs
• CMSs / Writing rooms
Big problems
Tiny solutions
Why static sites
• Fast
• Secure
• Scalable
• Simple themes and integrations
• Own conventions, languages, and tools
• Excellent version control story
The generators help!
Build
HTML
JS SVGCSS
GIF JPGPNG
Source
HTML
COFFEE SVG
TWIG ERB
SCSS
GIF JPGPNG
JSON YAML MD
Productivity, performance, security, scalability 

paid for with slow resource intensive build
processes
The new reality
Writes ReadsCheapExpensive
Requirements diminish
Server/CDN
File System
More hosting options open up
• Shared hosting
• VPS
• GitHub Pages (https://pages.github.com/)
• Dropbox (https://pages.github.com/)
• Google Drive (https://www.google.com/drive/)
• Amazon S3 (http://aws.amazon.com/s3/)
There are drawbacks
• Particularly with the concept of keeping content in flat files
• Hard to contribute (knowledge of Git)
• Hard to collaborate
Writing rooms to the rescue
• Contentful (https://www.contentful.com/)
• Prismic.io (https://www.prismic.io/)
• Pull in data through the API into a static build process
Focus
Admin interface for content creation and
collaboration
However…
• Subscription services
• Potential for vendor lock-in
• Lack of mature, open source alternatives
WordPress as a pure CMS
• WordPress can be used as an alternative to writing rooms like
Prismic.io and Contentful
• Content authors use WordPress to manage content and collaborate;
not to build web sites
• Content pulled out of WordPress and injected into static build
process
WP REST API
• Popular plugin that will be integrated into core
• Provides an HTTP REST API
• Extensive API for CRUD operations on comments, media, meta data,
posts, taxonomies, and users
• http://wp-api.org
Advanced Custom Fields Pro
• Popular plugin that allows for rapid creation of custom fields
• Supports many field types, including text, number, image, map,
links, and post references
• Rich ecosystem of extensions including repeaters
• http://www.advancedcustomfields.com
WP REST API Custom Fields
• Adds custom fields defined with ACF Pro to JSON output
• Inserts an object into the meta key with all your fields
• http://wordpress.org/plugins/wp-rest-api-custom-fields
Putting the backend together
• A 15-minute REST server with multi-user support, roles and
permissions, and an admin interface
1. Enable the aforementioned plugins
2. Setup friendly permalinks
3. Create custom post types if necessary
4. Setup custom fields if necessary
5. API accessible at /wp-json
Choosing a static site generator
• Comes in pretty much any language: C, C++, Java, Go, Haskell,
Erlang, JavaScript, Ruby, Python, PHP, etc.
• Choose a language you a comfortable with and enjoy working with
• Choose a system that is mature
• Choose a system that lets you work with many different types of
inputs, including remote content for maximum flexibility
Middleman
Hand-crafted frontend development

https://middlemanapp.com/
Key Features
• HTML, Markdown, YAML, and JSON format
• Templating language
• Asset pipeline
• Live reload
• Development server
• Common preprocessors and concat/minify out of the box
Useful Extensions
• Deploy
• Blog
• Pagination
• SVG Fallback
• Full list: https://directory.middlemanapp.com/#/extensions/all
Directory Structure
• Data
• Lib
• Source
• Images
• Javascripts
• Layouts
• Stylesheets
• Pages, posts, etc
Source
index.html.md
/about
Build
Data
/css /js/img
layout.html.erb logo.svg all.scss
_header.scss
_footer.scss
all.js
menu.coffee
feed.js
_header.html.erb
/layouts
Build
index.html
/about /css /js/img
logo.svg all.css all.js
logo.png
logo@2x.png
Dynamic Files
• Data is made available to our templates
• Useful for creating menus, lists, directories, etc.
• Pages can also be dynamically generated from data
sally.html roger.html sue.html
steven.html lisa.html
people
build
people.json
data
Dynamic Pages
In config.rb
people.each do |person|
proxy “people/#{person[‘name’]}.html”,
“layout/person.html”, locals: { person: person }
end
Data Source Library
In lib/wordpress.rb
class WordPress
include HTTParty
def initialize(uri)
self.class.base_uri uri
end
def posts
@posts ||= self.class.get(‘/posts?type=post’)
end
end
Dynamic Pages from Data Source
In config.rb
@wordpress = WordPress.new(“http://supersecret.dev/wp-json”)
@wordpress.posts.each do |post|
proxy “/blog/#{post[‘slug’]}/index.html”, “templates/post.html”,
locals: { post: post }
end
Expose Data Source to Templates
In config.rb
helpers do
def wordpress
@wordpress
end
end
Use Data Source in Templates
In source/blog/index.html
<% wordpress.posts.each do |post| %>
<div>
<h3><a href=“/blog/<%= post[‘slug’] %>/”><%= post[‘title’] %></a></h3>
<div><%= post[‘excerpt’] %></div>
</div>
<% end %>
Nicer than this!
<?php

if (have_posts()) {

while ( have_posts()) { 

the_post();

?>

<div>

<h3><a href=“<?php the_permalink(); ?>”><?php the_title(); ?></a></h3>

<div><?php the_excerpt(); ?></div>

</div>

<?php 

}

}

?>
There’s a plugin for that
• Hookpress
• Turns internal hooks into web hooks
• Recompile your site when content is updated
• https://wordpress.org/plugins/hookpress/
Middleman-WordPress Example
https://github.com/knicklabs/middleman-
wordpress-example
High Voltage - Building Static Sites With Wordpress-Managed Content

Mais conteúdo relacionado

Mais procurados

Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1asim78
 
SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01Sonja Madsen
 
EDS selection & implementation @ CCC
EDS selection & implementation @ CCCEDS selection & implementation @ CCC
EDS selection & implementation @ CCCMolly Beestrum
 
Overview of Coding Languages
Overview of Coding LanguagesOverview of Coding Languages
Overview of Coding LanguagesGlowTouch
 
Showcasing drupal
Showcasing drupalShowcasing drupal
Showcasing drupalOpevel
 
Did wordpressdothat
Did wordpressdothatDid wordpressdothat
Did wordpressdothatJon Bishop
 
High performance website
High performance websiteHigh performance website
High performance websiteChamnap Chhorn
 
WordPress Code Architecture
WordPress Code ArchitectureWordPress Code Architecture
WordPress Code ArchitectureMario Peshev
 
presentation on static website design
presentation on static website designpresentation on static website design
presentation on static website designjyotiyadav1926
 
Presentation 1 Web--dev
Presentation 1 Web--devPresentation 1 Web--dev
Presentation 1 Web--devaltsav
 

Mais procurados (20)

Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1Asp.Net 3 5 Part 1
Asp.Net 3 5 Part 1
 
Web browsers and web document
Web browsers and web documentWeb browsers and web document
Web browsers and web document
 
SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01SharePoint Framework, React and Office UI SPS Paris 2016 - d01
SharePoint Framework, React and Office UI SPS Paris 2016 - d01
 
Basic Website 101
Basic Website 101Basic Website 101
Basic Website 101
 
EDS selection & implementation @ CCC
EDS selection & implementation @ CCCEDS selection & implementation @ CCC
EDS selection & implementation @ CCC
 
Overview of Coding Languages
Overview of Coding LanguagesOverview of Coding Languages
Overview of Coding Languages
 
Showcasing drupal
Showcasing drupalShowcasing drupal
Showcasing drupal
 
Static web documents
Static web documents Static web documents
Static web documents
 
Did wordpressdothat
Did wordpressdothatDid wordpressdothat
Did wordpressdothat
 
High performance website
High performance websiteHigh performance website
High performance website
 
Automate capabilities
Automate capabilitiesAutomate capabilities
Automate capabilities
 
Single page application
Single page applicationSingle page application
Single page application
 
dmBridge & dmMonocle
dmBridge & dmMonocledmBridge & dmMonocle
dmBridge & dmMonocle
 
WordPress Code Architecture
WordPress Code ArchitectureWordPress Code Architecture
WordPress Code Architecture
 
Drupal at the EBI
Drupal at the EBIDrupal at the EBI
Drupal at the EBI
 
sell idea
sell ideasell idea
sell idea
 
presentation on static website design
presentation on static website designpresentation on static website design
presentation on static website design
 
Presentation 1 Web--dev
Presentation 1 Web--devPresentation 1 Web--dev
Presentation 1 Web--dev
 
VFP & Ajax
VFP & AjaxVFP & Ajax
VFP & Ajax
 
Single Page Application
Single Page ApplicationSingle Page Application
Single Page Application
 

Destaque

Is Any Job Better Than No Job?
Is Any Job Better Than No Job?Is Any Job Better Than No Job?
Is Any Job Better Than No Job?T & A Solutions
 
Qualities To Look For In A Recruitment Agency
Qualities To Look For In A Recruitment AgencyQualities To Look For In A Recruitment Agency
Qualities To Look For In A Recruitment AgencyT & A Solutions
 
Introduction to Enterprise architecture and the steps to perform an Enterpris...
Introduction to Enterprise architecture and the steps to perform an Enterpris...Introduction to Enterprise architecture and the steps to perform an Enterpris...
Introduction to Enterprise architecture and the steps to perform an Enterpris...Prashanth Panduranga
 
Factors to Consider Before Switching Your Job
Factors to Consider Before Switching Your JobFactors to Consider Before Switching Your Job
Factors to Consider Before Switching Your JobT & A Solutions
 
Things To Avoid At Office
Things To Avoid At OfficeThings To Avoid At Office
Things To Avoid At OfficeT & A Solutions
 
What's Your Element? - Ignite Presentation
What's Your Element? - Ignite PresentationWhat's Your Element? - Ignite Presentation
What's Your Element? - Ignite Presentationmaevekaiser
 

Destaque (11)

Is Any Job Better Than No Job?
Is Any Job Better Than No Job?Is Any Job Better Than No Job?
Is Any Job Better Than No Job?
 
Why nosql also_why_somany
Why nosql also_why_somanyWhy nosql also_why_somany
Why nosql also_why_somany
 
Being there
Being thereBeing there
Being there
 
Doc byyou
Doc byyouDoc byyou
Doc byyou
 
Qualities To Look For In A Recruitment Agency
Qualities To Look For In A Recruitment AgencyQualities To Look For In A Recruitment Agency
Qualities To Look For In A Recruitment Agency
 
Introduction to Enterprise architecture and the steps to perform an Enterpris...
Introduction to Enterprise architecture and the steps to perform an Enterpris...Introduction to Enterprise architecture and the steps to perform an Enterpris...
Introduction to Enterprise architecture and the steps to perform an Enterpris...
 
Maths probability
Maths probabilityMaths probability
Maths probability
 
Factors to Consider Before Switching Your Job
Factors to Consider Before Switching Your JobFactors to Consider Before Switching Your Job
Factors to Consider Before Switching Your Job
 
Things To Avoid At Office
Things To Avoid At OfficeThings To Avoid At Office
Things To Avoid At Office
 
Minerals
MineralsMinerals
Minerals
 
What's Your Element? - Ignite Presentation
What's Your Element? - Ignite PresentationWhat's Your Element? - Ignite Presentation
What's Your Element? - Ignite Presentation
 

Semelhante a High Voltage - Building Static Sites With Wordpress-Managed Content

Cms & wordpress theme development 2011
Cms & wordpress theme development 2011Cms & wordpress theme development 2011
Cms & wordpress theme development 2011Dave Wallace
 
Wordpress intro
Wordpress introWordpress intro
Wordpress introthe-colab
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANJeff Fox
 
Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Talbott Crowell
 
Week01 jan19 introductionto_php
Week01 jan19 introductionto_phpWeek01 jan19 introductionto_php
Week01 jan19 introductionto_phpJeanho Chu
 
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClassECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClassEuropean Collaboration Summit
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar litbbsr
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar litbbsr
 
Web programming
Web programmingWeb programming
Web programmingIshucs
 
Apache Content Technologies
Apache Content TechnologiesApache Content Technologies
Apache Content Technologiesgagravarr
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPAGil Fink
 
Week01 jan19 introductionto_php
Week01 jan19 introductionto_phpWeek01 jan19 introductionto_php
Week01 jan19 introductionto_phpJeanho Chu
 
Content Management Systems (CMS) & Wordpress theme development
Content Management Systems (CMS) & Wordpress theme developmentContent Management Systems (CMS) & Wordpress theme development
Content Management Systems (CMS) & Wordpress theme developmentDave Wallace
 
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript FrameworksBuilding Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript FrameworksFITC
 
Drupal and Apache Stanbol
Drupal and Apache StanbolDrupal and Apache Stanbol
Drupal and Apache StanbolAlkuvoima
 
BITM3730 11-8.pptx
BITM3730 11-8.pptxBITM3730 11-8.pptx
BITM3730 11-8.pptxMattMarino13
 

Semelhante a High Voltage - Building Static Sites With Wordpress-Managed Content (20)

Geek basics
Geek basicsGeek basics
Geek basics
 
Cms & wordpress theme development 2011
Cms & wordpress theme development 2011Cms & wordpress theme development 2011
Cms & wordpress theme development 2011
 
Wordpress intro
Wordpress introWordpress intro
Wordpress intro
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
 
Be faster then rabbits
Be faster then rabbitsBe faster then rabbits
Be faster then rabbits
 
Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?Custom Development in SharePoint – What are my options now?
Custom Development in SharePoint – What are my options now?
 
Week01 jan19 introductionto_php
Week01 jan19 introductionto_phpWeek01 jan19 introductionto_php
Week01 jan19 introductionto_php
 
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClassECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
ECS19 - Vesa Juvonen - SharePoint and Office 365 Development PowerClass
 
Tech talk php_cms
Tech talk php_cmsTech talk php_cms
Tech talk php_cms
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar
 
Php training in bhubaneswar
Php training in bhubaneswar Php training in bhubaneswar
Php training in bhubaneswar
 
Web programming
Web programmingWeb programming
Web programming
 
Apache Content Technologies
Apache Content TechnologiesApache Content Technologies
Apache Content Technologies
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
 
Week01 jan19 introductionto_php
Week01 jan19 introductionto_phpWeek01 jan19 introductionto_php
Week01 jan19 introductionto_php
 
Content Management Systems (CMS) & Wordpress theme development
Content Management Systems (CMS) & Wordpress theme developmentContent Management Systems (CMS) & Wordpress theme development
Content Management Systems (CMS) & Wordpress theme development
 
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript FrameworksBuilding Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
 
Drupal and Apache Stanbol
Drupal and Apache StanbolDrupal and Apache Stanbol
Drupal and Apache Stanbol
 
Emkane RCC wp qs
Emkane RCC wp qsEmkane RCC wp qs
Emkane RCC wp qs
 
BITM3730 11-8.pptx
BITM3730 11-8.pptxBITM3730 11-8.pptx
BITM3730 11-8.pptx
 

Último

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 

Último (20)

SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 

High Voltage - Building Static Sites With Wordpress-Managed Content

  • 1.
  • 2.
  • 3. …there was a time before WordPress
  • 5. Assemble pages by including common components
  • 6. Mix in data from other sources
  • 7. Emerging trends • DRY • Eliminate duplicate content • Separate concerns • Improve productivity
  • 9. They matter too But what about the content authors?
  • 10.
  • 11. Content is a first class citizen
  • 12. Further separation of concerns • Users enter content using a GUI • Programmers create templates that utilize the user-entered content • Web pages generated on demand
  • 14. It’s not • With (pretty much) any CMS: • Wrangling together templates and data is complicated • The process is demanding and involves needless work
  • 15.
  • 16. Most CMS-based websites Writes ReadsExpensiveModerate
  • 17.
  • 18. Some CMS-based websites Writes ReadsCheapModerate
  • 20. “The stack” stacks up HTTP Accelerator (Varnish) Web Server (Apache) Application Server (WordPress/PHP) Database (MySQL) Object Cache (MemCached) File System
  • 21.
  • 23. Do you build a solution for your problem or do you fit your problem into a solution?
  • 24. Build a solution • We have the tools: • Static site generators • Rapid application frameworks • APIs • CMSs / Writing rooms
  • 26.
  • 27. Why static sites • Fast • Secure • Scalable • Simple themes and integrations • Own conventions, languages, and tools • Excellent version control story
  • 28. The generators help! Build HTML JS SVGCSS GIF JPGPNG Source HTML COFFEE SVG TWIG ERB SCSS GIF JPGPNG JSON YAML MD
  • 29. Productivity, performance, security, scalability 
 paid for with slow resource intensive build processes
  • 30. The new reality Writes ReadsCheapExpensive
  • 32. More hosting options open up • Shared hosting • VPS • GitHub Pages (https://pages.github.com/) • Dropbox (https://pages.github.com/) • Google Drive (https://www.google.com/drive/) • Amazon S3 (http://aws.amazon.com/s3/)
  • 33. There are drawbacks • Particularly with the concept of keeping content in flat files • Hard to contribute (knowledge of Git) • Hard to collaborate
  • 34. Writing rooms to the rescue • Contentful (https://www.contentful.com/) • Prismic.io (https://www.prismic.io/) • Pull in data through the API into a static build process
  • 35. Focus Admin interface for content creation and collaboration
  • 36. However… • Subscription services • Potential for vendor lock-in • Lack of mature, open source alternatives
  • 37. WordPress as a pure CMS • WordPress can be used as an alternative to writing rooms like Prismic.io and Contentful • Content authors use WordPress to manage content and collaborate; not to build web sites • Content pulled out of WordPress and injected into static build process
  • 38. WP REST API • Popular plugin that will be integrated into core • Provides an HTTP REST API • Extensive API for CRUD operations on comments, media, meta data, posts, taxonomies, and users • http://wp-api.org
  • 39. Advanced Custom Fields Pro • Popular plugin that allows for rapid creation of custom fields • Supports many field types, including text, number, image, map, links, and post references • Rich ecosystem of extensions including repeaters • http://www.advancedcustomfields.com
  • 40. WP REST API Custom Fields • Adds custom fields defined with ACF Pro to JSON output • Inserts an object into the meta key with all your fields • http://wordpress.org/plugins/wp-rest-api-custom-fields
  • 41. Putting the backend together • A 15-minute REST server with multi-user support, roles and permissions, and an admin interface 1. Enable the aforementioned plugins 2. Setup friendly permalinks 3. Create custom post types if necessary 4. Setup custom fields if necessary 5. API accessible at /wp-json
  • 42.
  • 43. Choosing a static site generator • Comes in pretty much any language: C, C++, Java, Go, Haskell, Erlang, JavaScript, Ruby, Python, PHP, etc. • Choose a language you a comfortable with and enjoy working with • Choose a system that is mature • Choose a system that lets you work with many different types of inputs, including remote content for maximum flexibility
  • 45. Key Features • HTML, Markdown, YAML, and JSON format • Templating language • Asset pipeline • Live reload • Development server • Common preprocessors and concat/minify out of the box
  • 46. Useful Extensions • Deploy • Blog • Pagination • SVG Fallback • Full list: https://directory.middlemanapp.com/#/extensions/all
  • 47. Directory Structure • Data • Lib • Source • Images • Javascripts • Layouts • Stylesheets • Pages, posts, etc
  • 48. Source index.html.md /about Build Data /css /js/img layout.html.erb logo.svg all.scss _header.scss _footer.scss all.js menu.coffee feed.js _header.html.erb /layouts
  • 49. Build index.html /about /css /js/img logo.svg all.css all.js logo.png logo@2x.png
  • 50. Dynamic Files • Data is made available to our templates • Useful for creating menus, lists, directories, etc. • Pages can also be dynamically generated from data
  • 51. sally.html roger.html sue.html steven.html lisa.html people build people.json data
  • 52. Dynamic Pages In config.rb people.each do |person| proxy “people/#{person[‘name’]}.html”, “layout/person.html”, locals: { person: person } end
  • 53. Data Source Library In lib/wordpress.rb class WordPress include HTTParty def initialize(uri) self.class.base_uri uri end def posts @posts ||= self.class.get(‘/posts?type=post’) end end
  • 54. Dynamic Pages from Data Source In config.rb @wordpress = WordPress.new(“http://supersecret.dev/wp-json”) @wordpress.posts.each do |post| proxy “/blog/#{post[‘slug’]}/index.html”, “templates/post.html”, locals: { post: post } end
  • 55. Expose Data Source to Templates In config.rb helpers do def wordpress @wordpress end end
  • 56. Use Data Source in Templates In source/blog/index.html <% wordpress.posts.each do |post| %> <div> <h3><a href=“/blog/<%= post[‘slug’] %>/”><%= post[‘title’] %></a></h3> <div><%= post[‘excerpt’] %></div> </div> <% end %>
  • 57. Nicer than this! <?php
 if (have_posts()) {
 while ( have_posts()) { 
 the_post();
 ?>
 <div>
 <h3><a href=“<?php the_permalink(); ?>”><?php the_title(); ?></a></h3>
 <div><?php the_excerpt(); ?></div>
 </div>
 <?php 
 }
 }
 ?>
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63. There’s a plugin for that • Hookpress • Turns internal hooks into web hooks • Recompile your site when content is updated • https://wordpress.org/plugins/hookpress/