Hari I don't know all details but iframe URL should be like this: https://domain/embed/discussionid

For example:

Normal URL: https://discuss.flarum.org/d/27814-embed-discussion-in-a-different-page-extension-wish

Embed URL: https://discuss.flarum.org/embed/27814

Hari yes. It's a Flarum core extension. It's not just installed by default.

Automating the creation and linking of discussions is something that extensions need to do however. My Wordpress extension does it for example, then uses a customized version of flarum/embed to show it on the page.

    clarkwinkelmann when I saw this post I thought about our wp integration

    once could you check this page they have done something similar to wp extension (a javascript integration) but it's on a static page .. the discourse extension allows to manage/restrict access of embedding to the self domain.

    what they have shown in the above video is really cool.

    we are switching to static pages (gatsby, docs, Github pages ..etc)

    I think automation is not needed cuz we just create blogs or pages and embed them manually in most cases.

    easy modifications to embed can make similar functionality like discourse?

    • Edit :

    Hari will this consume additional system resources/ burden to the system?

    we are planned to use flarum cache & gatsby cache too

    • 1Dot replied to this.
      Hari changed the title to Embed Discussion in a different page .

      how to install latest version of embed?

      composer require flarum/flarum-ext-embed

      or

      composer require "flarum/flarum-ext-embed":"dev-master"

        Justoverclock

          Problem 1                                                                                                                                                             
            - Root composer.json requires flarum/flarum-ext-embed dev-master -> satisfiable by flarum/flarum-ext-embed[dev-master].                                             
            - flarum/flarum-ext-embed dev-master requires flarum/core ^0.1.0-beta.8 -> found flarum/core[v0.1.0-beta.8, ..., v0.1.0-beta.16] but it does not match your minimum-
        stability.                                                                                                                                                              
                                                                                                                                                                                
        Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.     

        Justoverclock thanks, the embed is working now

        how to restrict embed to my domain only? like mentioned here

        i do not want someone else to put my embed code and load my site

        and will this consume additional system resources/ burden to the system?

        Edit:

        <iframe src="https://www.site.com/ask/embed/10" width="100%" frameborder="0" scrolling="no" height="19261px"></iframe>
        is this the best way to embed? On his page it's nice like no extra scroll .. it looks like native comments

        with current flarum embed and iframe when the user clicks back or other buttons it's going to a different page

        can we display only comments and when the user clicks take him to the main discussion page? like happing at

          Hari changed the title to Embed Discussion in a different page : solved .
          Hari changed the title to Embed Discussion in a different page .
          Hari changed the title to Embed Discussion in a different page : solved .

          I see the issue is solved but just for reference all flarum/flarum-ext-* are old names that have been abandoned. All core extensions use flarum/* names.

          Please do not install dev-master versions of Flarum core and extensions unless you are working on pull requests for the extension. We have tagged releases for all extensions, so "*" is the correct version to use.

          Hari it's nice like no extra scroll

          The embed extension has a similar feature using the iframe-resizer library. You can see the content script of that library is loaded inside of the iframe https://github.com/flarum/embed/blob/master/js/src/forum/index.js#L1 so all you need to do is load the iframe-resizer on your website outside of the iframe so they can talk together and resize the iframe. That being said I tried to use that feature in my Wordpress extension in the past and it doesn't work very well with the infinite scrolling, so I abandoned.

          Hari how to restrict embed to my domain only

          I think HTTP headers can be used to restrict that. There's the soon obsolete X-Frame-Options https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options and now CSP https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors

            clarkwinkelmann thanks for taking the time and explaining. i've used composer require flarum/embed:"*" to install the embed extension.

            as I feel that the posting interface/user experience on a flarum forum is currently much richer than what we could embed via Javascript.

            in any other embed area, it will open a lot of popups and behaves like a mobile website

            1. will iframe consumes additional system resources/ burden to the system?
            2. how to take the user to discussion directly? I want the user should go to the discussion page even when clicking on the individual comment replay button. (can we just disable the reply button?)
            3. how display comment count?

            can we modify the embed extension & build our own embed look with the above-mentioned features?

              Hari can we modify the embed extension & build our own embed look with the above-mentioned features?

              got it so we can build a custom class for ourselves as per our needs