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

Wrong __DIR__ variable #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sschutte
Copy link

The default folder '/var/www' was just '/var' so the plugin did not work at all.

The default folder '/var/www' was just '/var' so the plugin did not work at all.
@james2doyle
Copy link
Owner

So this still works if the folder is more than one level deep?

@sschutte
Copy link
Author

As far as I can understand it does. I should have maybe clarified a little more from the beginning.
Basically I have

content/download/test.txt

With this pull, I can download test.txt simply by adding the following to my index.md file in the 'content/download' folder:

<a href="test.txt">Download test.txt</a>

If I understand your question correctly, I can go one level deeper. So I created the folder
'content/download/deeper/test.txt'.

The link now is

<a href="deept/test.txt">Download test.txt</a>

That seems to work correctly.

@james2doyle
Copy link
Owner

Are you not using the {{ download_url }} variable?

@sschutte
Copy link
Author

No not all.

If I understood correctly:

Let's say you want to download test.txt. In your template you'd link to it like this:


<a href="{{ download_url }}/test.txt">Download test.txt</a>

Unless you simply mean the index.md file in the 'download' folder. If I do that, as in the above example,
{{ download_url }} does not get interpreted at all.

The URL in the browser produces:


download/%7B%7B%20download_url%20%7D%7D/test.txt

Which of course results in a 404 error.

@james2doyle
Copy link
Owner

Yeah, you would use {{ download_url }} in your templates not your markdown files.

What I am asking is, what happens when you link to a file that you don't want to download in your markdown? You should want the path to be download/file.txt because that is how the system knows to trigger a download.

With this PR, what happens if you do

<a href="index">Homepage</a>

In your markdown file now?

@sschutte
Copy link
Author

What I am asking is, what happens when you link to a file that you don't want to download in your > >markdown?

With this PR, what happens if you do

<a href="index">Homepage</a>

In your markdown file now?

Ok, as a test I added the line:

<a href="index">Homepage</a>

to content/download/index.md.

when clicking the link nothing happens. The URL is simply download/index

@james2doyle
Copy link
Owner

Ok that wasn't really what I was going for.

How about create content/test.md and throw <a href="index">Homepage</a> in the body. And then go to the page and click the link.

What I am saying is that all links, that you want to trigger a download, should begin with download/. Otherwise, random content and other links are going to be downloaded.

@sschutte
Copy link
Author

Ok created the content/test.md containing <a href="index">Homepage</a> in the body and clicked the link.

The result was: The requested URL /index was not found on this server.

@james2doyle
Copy link
Owner

Do you not have a file called index.md in your content folder?
On Wed, Nov 26, 2014 at 4:15 PM Shaun Schutte notifications@github.com
wrote:

Ok created the content/test.md containing Homepage in
the body and clicked the link.

The result was: The requested URL /index was not found on this server.


Reply to this email directly or view it on GitHub
#2 (comment)
.

@sschutte
Copy link
Author

ls /var/www/content/

404.md  
index.html  
index.md  
sub  
test.md 

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

Successfully merging this pull request may close these issues.

2 participants