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

read_more_link malformed images URLs in summary and broken read more links #147

Closed
ahmetb opened this issue Feb 7, 2014 · 5 comments
Closed

Comments

@ahmetb
Copy link

ahmetb commented Feb 7, 2014

@VuongN's new plugin renders summary in a way that while serving the content on localhost with make serve, images in the summaries are linked to the blog URL.

Disabling read_more fixes this. This issue is impacting creating posts which are not uploaded to the web yet since in the summary, images linked to a URL which does not exist, yet.

@ahmetb
Copy link
Author

ahmetb commented Feb 7, 2014

"Read more" link does not link to the correct URL.

EDIT: I fixed the problem in this comment by changing /{url} to {url}. But image link issue still persists.


In my publishconf.py I have

SITEURL = 'https://ahmetalpbalkan.com/blog'
HOMEURL = 'https://ahmetalpbalkan.com/'
ARTICLE_URL             = '{slug}/'
ARTICLE_SAVE_AS         = '{slug}/index.html'

READ_MORE_LINK = '<nobr> Read more &rarr;</nobr>'
READ_MORE_LINK_FORMAT = "<a href='/{url}'>{text}</a>"

and it makes links to https://ahmetalpbalkan.com/{slug} That's severely broken.

@VuongN
Copy link
Contributor

VuongN commented Feb 7, 2014

Hi @ahmetalpbalkan: would changing the READ_MORE_LINK_FORMAT settings in the following way help?

READ_MORE_LINK_FORMAT = "<a href='%s/{url}'>{text}</a>" % SITEURL

If so, then perhaps I should either use settings.SITEURL at https://github.com/getpelican/pelican-plugins/blob/master/read_more_link/read_more_link.py#L56 or figure out a clever way to allow you to pass in a SITEURL value dynamically. What do you think?

-V.

@ahmetb
Copy link
Author

ahmetb commented Feb 7, 2014

I solved that problem just by removing / in the beginning. Solved the case for me. I'm not sure yours is a better solution because even while serving on localhost it will make the link go to SITEURL.

What about the image links issue?

@VuongN
Copy link
Contributor

VuongN commented Feb 7, 2014

Hello again, @ahmetalpbalkan. I've created a pull request to address the relative/absolute url generation issue. I'm going to think some more about the localhost situation.

Personally, I use zc.buildout to create and control my environments. In this way, I am able to switch settings according to which environment (local vs prod) and thus can have different SITEURL respectively. I understand this doesn't directly address your issue.

As far as the image links, remember that read_more_link is only trying to generate a "read more link" and nothing else (thus the name). I think whatever plugin you're using to generate summary is having the same problem as read_more_link before my pull request #148.

EDIT: Oh, I just realized something. If you were to use the codes from #148, when you're working in local environment, you could set READ_MORE_LINK_RELATIVE = False and links would be relative. When you deploy, just remove it or set READ_MORE_LINK_RELATIVE = True

Hope that helps.
-V.

@ahmetb
Copy link
Author

ahmetb commented Feb 7, 2014

I am not using any other summary plugins. I am just using Pelican's SUMMARY_MAX_LENGTH setting and images in the summary do not get linked to the SITEURL. And my theme just uses {{ article.summary }} property (just like other themes do).

When you disable read_more_link and run: make html && make serve and navigate to localhost, are images that appear in summary linked to SITEURL or relative? They should be relative. But when I turn on read_more_link it becomes absolute urls with SITEURL.

You may be using zc.buildout but please do not break people's workflows.

@ahmetb ahmetb closed this as completed Jun 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants