I am trying to upload a collection of Website items using a CSV file. When it imports the Item Type Metadata:Local URL, already formatted in html, the link always ends up referring back to the Omeka site rather than linking out.
field value as entered:
<a href=url> …etc (but can’t post more than two links in forum post)
shows up on page as: http://amongdreams.com
but links to my local installation: http://omekax.grinnell.edu/Lewis/admin/items/show/id/url
which is a 404
The same thing happens if I switch the Item Type to a Hyperlink.
I am using the forked CSV plugin by Daniel Berthereau on Omeka 2.4.1.
Thanks for any guidance you can provide!
I don’t understand what means “Item Type Metadata:Local URL, already formatted in html”. No change is done on content during import. If the cell is “http://mysite.com/my/link”, it will be imported as it.
Anyway, for such import, there is no difference between my fork and the original one.
Note: The link you show is private and I can’t check it.
Thanks for responding, Daniel. I didn’t think it was necessarily a difference with the fork, just wanted to be clear about what I was using.
By formatted as html, I mean written out: a href = etc. As text, not as an embedded link. Are you saying I should embed the link in the CSV file?
The problem is that for some reason the link is showing up on the item page and on the public view page as that private, internal link even though the text is what I entered. This happens even when I set the item to public.
As you know already, the fork is an amazing tool & has been very helpful to the people I am working with. Thank you for building it!
I think the confusion here was partially because of the forum software. If you want to post readable code you need to select the code you put in and click the
</> button in the toolbar. I edited your first post so the code you included is visible.
A link like
<a href="url"> is a relative link, which is almost certainly not what you want as what it points to changes depending on what page it’s displayed on. The link text itself isn’t getting changed anywhere, it’s just the way a relative link works.
Your links should be absolute (i.e., start with
http://) for them to work correctly.
Furthermore, it’s not recommended to add too many html code in Dublin Core elements, except for the description. It simplifies exchanges with other systems and long term preservation.
So your value should not be “
<a href="http://mysite.com/my/url">”, but simply “
http://mysite.com/my/url”. Next, in the theme, you can display it as a link.
Thank you both for responding. The first time we tried importing, we did simply have the
http:// format, nothing else, but it shows up on the item record and public view as flat text, not a working link.
But it sounds like this is something that is theme-dependent? As in, at the level of the Settings tab for that theme, or at the CSS level?
There are multiple solutions to your issue.
On my point of view, metadata should be separated from the display: Omeka is a cms: content is totally separated from the display. So the metadata should be the simple url for long term maintenance.
If you want to import only the url, you have to change all the pages where this metadata appears, or use a simple plugin like this one: https://github.com/Daniel-KM/LinkifyUrl
If you want to keep the link in the metadata, you should check the checkbox “html” of the element “Item Type Metadata:Local URL” in the page items/edit/xxx. This can’t be done automatically with the original CsvImport, but with the fork, you can update items. So in a second step, you can import only the links and set “html” in the parameters of the import.
Thank you for your continued help & describing these options, and the reminder to keep the simple url as metadata for long term maintenance.
–I installed the plugin, which appeared to install successfully but did not generate the “configure” icon that usually shows up in the user view and did not seem to turn the url into a link for either existing or newly uploaded data. Is there a way that I need to configure it from the file first?
–Uploading the simple url as
http://etc as an update with the plugin & the “Elemetnts are html” box checked didn’t create the links.
–I’ve double checked that “Use html” is checked on all of the Item Type Metadata fields for each item.
Right now, the users’ collection is only about 100 items, so we’ll probably just accept the clunkiness of uploading the (now corrected) formatted html version.
The plugin is just a quick code to show how to do a standard filter on metadata. There is no config page.
How it works (https://github.com/Daniel-KM/LinkifyUrl/blob/master/LinkifyUrlPlugin.php#L42):
if the element is displayed in public theme, and the element metadata is not html, then replace the raw text, i.e. the url “http://xxx”, into a link
In your case, the “Use html” is set, so the filter return the original text, without converting it into a link.
So there are two options (a raw url + without “Use html” + the filter OR a link + with “Use html”), but you shouldn’t mix them.
Thanks for the explanation–now that I’ve unchecked the Use html box, it is all working smoothly as you designed. Thank you!