ember-wordpress icon indicating copy to clipboard operation
ember-wordpress copied to clipboard

Clarify how to deploy

Open oskarrough opened this issue 9 years ago • 9 comments

You have (at least) two options:

  1. Deploy to a seperate host from your Wordpress install
  2. Deploy as a Wordpress theme

Solution 1 is definitely the simplest as it doesn't require any extra steps but the DNS management. Solution 2 also works, but requires a few nifty tricks to work properly.

I'll have to add this to the readme. Until then, you can ask here.

oskarrough avatar Mar 22 '16 11:03 oskarrough

What about option 3?

  • root
    • ember app
    • cms
      • wp-content etc...

Keeping the CMS totally separate / but on the same host is great for client and developer.

There are many gotchas around pretty-permalinks and other terminal host/apache stuff that all depend on the setup. I'll try to collect the Digital Ocean issues next fresh project.

sheriffderek avatar Mar 23 '16 22:03 sheriffderek

Yes, that's actually how we normally do it.

  • Install Wordpress into a wp subdirectory
  • In the root upload the assets folder that ember-cli generates
  • Put the ember app inside the Wordpress theme
  • In the active Wordpress theme, copy/paste everything from your Ember apps index.html

Because of the <base> tag Ember generates, this works. Although it's a pretty frustrating workflow…

oskarrough avatar Mar 24 '16 10:03 oskarrough

This line in functions.php can also be critical, if you have your Ember app inside a WP theme.

// Remove canonical redirects that would otherwise overwrite the Ember routing
remove_filter('template_redirect', 'redirect_canonical');

oskarrough avatar Mar 24 '16 10:03 oskarrough

I'm still wondering why you put the Ember app inside the WordPress theme vs just having it in the root of your host public folder - or really, anywhere else.

sheriffderek avatar Mar 24 '16 23:03 sheriffderek

I might be going the wrong way about this but putting it inside a Wordpress theme allows you to let Wordpress do the initial routing BEFORE your Ember app is loaded.

This is essentially server-side rendering, which might be useful for SEO. Personally I prefer to let Google figure it out these days but some clients require it for sharing on, say, Facebook, who can't read JavaScript apps yet.

oskarrough avatar Apr 22 '16 10:04 oskarrough

Very interesting. I'll have to check into that.

I didn't worry about it on a site - and to my surprise everything was thoroughly indexed by Google - down to the orphaned routes I had left in there ~ so I figured that wasn't a thing anymore. BUT - if there is a way to have WP just automatically do the work instead of adding fastboot - that could be really convenient.

sheriffderek avatar Apr 22 '16 19:04 sheriffderek

Maybe a section in the readme with links to ember-cli-deploy and surge.sh would know this out. + a clear explanation of how the Ember app is essentially a separate entity - that doesn't really care where your WP install is. BUT there are some considerations depending on CORS and other things to ensure proper refresh... so we should try and collect those bits.

sheriffderek avatar Oct 18 '16 22:10 sheriffderek

to deploy it using theme you have to convert the ember app into wordpress theme

  • rename the index.html to index.php
  • add this one your newly rename index
  • and insert some of the server rendering script to make sure your all your pages are seo friendly ` EmberApp
<noscript>
    <?php
    if ( have_posts() ) :
        if ( is_home() && ! is_front_page() ) {
            echo '<h1>' . single_post_title( '', false ) . '</h1>';
        }
        while ( have_posts() ) : the_post();
            if ( is_singular() ) {
                the_title( '<h1>', '</h1>' );
            } else {
                the_title( '<h2><a href="' . esc_url( get_permalink() ) . '">', '</a></h2>' );
            }
            the_content();
        endwhile;
    endif;
    ?>
</noscript>
` - its important to make sure all the routes match the route in wordpress to trigger all the seo keywords,description and title

chriswebd avatar Apr 01 '17 11:04 chriswebd

🌚

josephbergdoll avatar Apr 19 '17 17:04 josephbergdoll