Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how to deploy #11

Open
oskarrough opened this issue Mar 22, 2016 · 9 comments
Open

Clarify how to deploy #11

oskarrough opened this issue Mar 22, 2016 · 9 comments

Comments

@oskarrough
Copy link
Owner

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.

@sheriffderek
Copy link

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.

@oskarrough
Copy link
Owner Author

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
Copy link
Owner Author

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');

@sheriffderek
Copy link

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.

@oskarrough
Copy link
Owner Author

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.

@sheriffderek
Copy link

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
Copy link

sheriffderek commented Oct 18, 2016

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.

@chriswebd
Copy link

chriswebd commented Apr 1, 2017

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
    ` <title>EmberApp</title>
<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

@josephbergdoll
Copy link

🌚

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants