axitkhurana / buster

Brute force static site generator for Ghost
MIT License
800 stars 139 forks source link

Links to the home page generated by themes are not corrected #45

Open nlowe opened 9 years ago

nlowe commented 9 years ago

Some themes link back to the home page by clicking on the blog title or in a footer. These links point to localhost:2368 or whatever port the local ghost instance is running on.

arranf commented 9 years ago

Have you edited your URL in the config file?

nlowe commented 9 years ago

How would one go about doing that?

If I change my config to look like:

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'https://techwiz24.github.io/ghost-test',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },

        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    },

then buster responds with:

--2014-12-11 08:48:12--  http://localhost:2368/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:2368... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-12-11 08:48:12 ERROR 404: Not Found.
kaicataldo commented 9 years ago

Just a shot in the dark, but are you running Ghost in the right environment? The snippet of config.js you copied and pasted is from the production environment section, and Ghost defaults to the development environment (odd, I know). I don't think it really makes a difference at the moment which one you use, particularly if you're using Buster to turn it into a static site, but I think the plan is to differentiate them more in the future.

To start ghost in the production environment, you'll need to use the command 'npm start --production'.

darrenkclee commented 9 years ago

I'm having the same problem. My buster generated blog on GitHub Pages is showing localhost:2368 as the blog url. I have already changed the url in config.js

Do I have to run Ghost in the production environment before deploying with buster?

thedannywahl commented 9 years ago

I'm experiencing this too, but only with certain links. For example here is some of the html output for /page/6/

<article class="post tag-javascript">
    <header>
        <h1><a href="http://localhost:2368/memrise-beta-tweaks/">Memrise (Beta) Tweaks</a></h1>
    </header>
    <div class="meta">
        <time datetime="2012-09-01">September 01, 2012</time>
         • 
        <span class="tags"><a href="http://localhost:2368/tag/javascript/">JavaScript</a></span>
    </div>
    <div class="text">
        <p>I love memrise. Not just as a concept or a webapp, but as a learning tool. I use it daily. But there are a few issues that I wish they would address that just haven’t been done yet, so I wrote a Greasemonkey script</p>
        <br>
        <a href="http://localhost:2368/memrise-beta-tweaks/" class="readmore">Continue Reading</a>
    </div>
</article>
<article class="post tag-wordpress tag-portfolio">
    <header>
        <h1><a href="../../chengdu-international-school/">Chengdu International School</a></h1>
    </header>
    <div class="meta">
        <time datetime="2012-07-13">July 13, 2012</time>
         • 
        <span class="tags"><a href="../../tag/wordpress/">WordPress</a>, <a href="../../tag/portfolio/">Portfolio</a></span>
    </div>
    <div class="text">
        <p>cdischina.com</p>
        <br>
        <a href="../../chengdu-international-school/" class="readmore">Continue Reading</a>
    </div>
</article>

notice that every link for the first article is localhost:2368 whereas the second article is ../../ here's further down the page:

    <a href="../5/" class="btn nav prev">
      <span aria-hidden="true" data-icon="&gt;"></span>
      Newer
    </a>
    <a href="http://localhost:2368/page/7/" class="btn nav next">
      <span aria-hidden="true" data-icon="&gt;"></span>
      Older
    </a>

Unfortunately this particular one causes buster to stop busting at page 6 as it never finds page 7 :sob:

note all of the posts themselves actually exist- just not the archive pages to link to them.

joseph-zhong commented 9 years ago

Any remedies that might work?

I don't think it's a problem with Ghost, just Buster...

thedannywahl commented 9 years ago

@Jaberer This is actually an issue with the underlying wget command, not with buster. I tried running it itself and got the same error, with many variations. I've stopped using buster and switched to httrack

eladrianovalle commented 9 years ago

I found that editing the config.js file works perfectly.

One warning though: at first I too thought it hadn't worked because I edited the file and then deployed the changes WHILE THE SAME INSTANCE OF GHOST WAS STILL RUNNING! So, the changes I had made were not yet included.

Make sure you end the current session, start a new session, and then generate your static page and deploy it. Worked for me.

dataaa commented 9 years ago

Can someone actually go step-by-step through the fix for this? If there is one.

I've edited all URLs in config.js to point to my URL.

I start Ghost with: npm start I run Buster with: buster generate --domain=http://mywebsite.com buster deploy

and I still get localhost:2368 links on my live site.

thedannywahl commented 9 years ago

There are two issues AFAIK. The first issue is in the generated wget command. It does not specify the recursive download depth so it uses the default, which is 5, so anything on /page/6/ or higher is skipped. The skip is to add the -l parameter and a value to the command.

The second issue is that some pages are NOT linked directly in the ghost output file and thus need to be manually specified to be downloaded- I don't know a fix for this.

ssang4 commented 8 years ago

Problems all solved by doing everything on Linux instead of Windows. Remember to start local server using 'npm start --production'

eldiyar7 commented 7 years ago

about environments

ikhwanuddin commented 6 years ago

Hi, I also experienced the same problem. However, I have tried all the suggestions above and nothing work.

So I am checking some *.hbs files. My issues are:

  1. Wrong URL for twitter/facebook sharing button.
  2. Wrong URL for disqus unique connection.

I check floating-header.hbs and found this:

<a class="floating-header-share-fb" 
href="https://www.facebook.com/sharer/sharer.php?u={{url absolute="true"}}"

The result is this URL:

https://www.facebook.com/sharer/sharer.php?u=http://localhost:2368/a-blog-post-title/

I think buster failed to convert some url commands become static.

I need to alter the absolute url, but I don't have a clue. So I modify the code inside `floating-header.hbs like this:

<a class="floating-header-share-fb" 
href="https://www.facebook.com/sharer/sharer.php?u=https://yourblogaddress.com{{url}}"

See.. insert your blog address and let alone url without any argument. Deleteabsolute="true".

From this:

u={{url absolute="true"}}

Become this:

u=https://yourblogaddress.com{{url}}

This trick run well too for disqus canonical URL variable.

It works for me ... in September 2018.