Giter Site home page Giter Site logo

Comments (5)

ahmetb avatar ahmetb commented on August 21, 2024

"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.

from pelican-plugins.

VuongN avatar VuongN commented on August 21, 2024

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.

from pelican-plugins.

ahmetb avatar ahmetb commented on August 21, 2024

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?

from pelican-plugins.

VuongN avatar VuongN commented on August 21, 2024

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.

from pelican-plugins.

ahmetb avatar ahmetb commented on August 21, 2024

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.

from pelican-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.