Help with structuring a Tainacan site

Hi folks,

I’ve been setting up Tainacan, but have ran into some customization issues.

Here’s what I’m trying to do:

  • I would like to have a main page for each collection that includes a description with light formatting (paragraphs, bold, lists, links).
  • Each item within the collection includes a link back to the collection’s main page.

This seems like it should be simple, but I’ve run into some issues:

  • The built-in description field for a Tainacan collection does not allow any formatting. That’s okay (I thought), I can just create a regular static page and add a block that lists the items. But then I can’t figure out how to add a way for the user to return from the item to that static page.

Any help would be much appreciated! :slight_smile:

Hi @alehandrof, welcome to our forum!

That is true. You can use <strong> and <em> tags, but that’s all. We do have plans to offer a mini editor in these area do allow more inputs. Currently, allowing more markup inside the textarea could be a security issue, so we’re holding that issue for a while.

Yes, that would be the recommended approach. You can define the page as the “Collection cover page” and inside it use the Faceted Search block to render the item list.

Now, regarding adding a link in the item page template… that depends on your theme. It should provide some breadcrumb or an option to add this link. If you are using Tainacan Interface or Blocksy (with the integration plugin) they both have breadcrumbs. A more prominent link could be added via PHP hooks. If you tell me which one are you using I can give you some code snippet for that.

1 curtida

This would be a great feature! This would solve my issue and I think would make the collection descriptions more attractive. (Maybe just allowing Markdown might be safer!)

But for the moment…

We are using Blocksy. I have enable the breadcrumbs, but the breadcrumb leads back to the collection page, which doesn’t have the extended description we need. Can I alter the breadcrumbs somehow to lead back to the static page that describes the collection? Would that require a code snippet?

Exactly, we’ll probably do something that allows what basic Markdown allows. But with a small wysiwyg UI for that.

Is it leading back to the collection items list even if you configure the page as the Collection cover (Tainacan Admin → Collection Settings → Enable cover page)? If yes then we would need a code snippet. Good news is Blocksy has several hooks in its code so we can add extra content in multiple places in the single item template.

1 curtida

Hi Mateus,

Ooh, that’s a nice feature, I hadn’t noticed that!

I set up a cover for the collection, but the breadcrumb in the item takes me back to the collection items list, not the cover. (I tried creating a new item and turning the breadcrumbs on-and-off again, just in case there’s a caching thing.)

Is there a code snippet that can fix or replace that?

In addition to this issue, there’s another thing I would appreciate some help with. We’re using Tainacan to display oral history collections, by embedding OHMS Viewer through an iframe as each item’s document.

I can set the dimensions of the iframe, but then that is wrapped up in a smaller block that I can only give a relative size to (vh). I would like to be able to make that block be the exact same size as the iframe, so the user can just see the whole iframe (OHMS Viewer) without needing to scroll.

Edit: this is an example of the iframe I’m trying to embed: SAMPLE 001: Interview with Georgia Davis Powers, April 26, 2013

Yeah I checked here and this is the behavior now, but is should be possible, I’ll see if I add this to our pipeline as well.

If you want to just change the breadcrumbs, then this should help:

If you want to add a link somewhere else in the page, then maybe one one action would help you. For example:

function my_page_hero_custom_after_title() {
     echo '<a href="www.my-collection-link.com">Back to collection</a>;
}
add_action('tainacan-blocksy-single-item-after-title', 'my_page_hero_custom_after_title');

Would add a link right after the title section of the page;

Can you share a link of a page where you are trying this? Overall my suggestion for that kind of content would be to use the Item page layout that puts the item document and attachments aside the metadata.

This way you could allow the viewer to be as height as the page.

It is a bit hard to style things that come inside iframes since their height might vary on the container. That dimensions feature that you mentioned is used to calculate the aspect ratio of the responsive wrapper that is added but the width will vary according to screen size and other stuff…

1 curtida

Hi Mateus!

Thanks for the code snippets. As far as I understand them, they would both change (or provide) links for all collections, but I have different cover pages for different collections. So that doesn’t quite work for me. Is there a way to adjust the Blocksy breadcrumb per collection (using the first part of the slug perhaps to identify the collection?)

My temporary fix is to set up 307s (temporary redirects) to “/xyz-collection/” to “/xyz/”

As for the iframe, I understand the potential issues, but I would very much like to hardcode the height. If you can suggest a snippet for that, I would be grateful!

If I am not mistaken, you could call this function to dynamically get the current collection link (needs testing):

tainacan_get_the_collection_url()

Clever one actually… anyways, I’ll see if I find a moment to implement the expected behavior in the breadcrumb:

There might be one solution via .css or maybe we’ll need filters to disable the responsive wrapper that we add there. Just to make sure which is better, can you provide me a public link of your item page so I can do some testing in the browser?

1 curtida

Here are two public links.

This is from our actual collection, using the side-by-side layout that you suggested: Afrasiab Khan – AMICAL Repository [alpha]

This is an example item, with the OHMS iframe placed above the metadata: Interview with Georgia Davis Powers (April 26, 2013) – AMICAL Repository [alpha]

I really appreciate all the help! :blush:

1 curtida

There might be one or more solution to this, with different levels of complexity…But let’s see:

From my understanding, the issue with today’s options is that they can only be relative units (vh). So you could via css set it fixed:

[data-prefix="tnc_col_148_item_single"] .tainacan-media-component {
  --document-height: 1200px !important;
  --document-width: 100% !important;
}

The tnc_col_128_item_single is the item post type for collection of ID 128. You can check the collection ID in the URL when you access the admin collection area. For a more generic approach, that would affect all items from all collections:

.single .tainacan-media-component {
  --document-height: 1200px !important;
  --document-width: 100% !important;
}

That sets the “default” dimensions for the document area. Still if you do that you’ll notice that in smaller screens, the scrollbar will appear… so if you dig into the HTML you’ll see that there is one DIV:
image

This div, alongside it’s parent, allow us to build responsive iframes. It detects, based on the width and height values that you set on the document settings, which is the approximate aspect ratio (1/2 in this case). So if you’re in a container smaller than the width set, it proportionally adjusts width and height. This is how YouTube Does. That only works for a known set of aspect ratios, however. So to get rid of this, it will be a bit more hacky:

.tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed {
    height: 1200px !important;
    widht: 100% !important;
}
:not(.wp-block-embed__wrapper) > .tainacan-has-aspect-ratio .tainacan-content-embed__wrapper::before {
    padding-top: 0px !important;
}
:not(.wp-block-embed__wrapper) > .tainacan-content-embed .tainacan-content-embed__wrapper {
    position: initial !important;
}

Let me know if this helps!

1 curtida

Hi Mateus,

After a bit of tweaking, I got a solution that seems adequate. I settled on using 600x1200px for the iframe and scoping the CSS to the specific collection, which uses that iframe. I’ll have to add additional selectors for any further such collections we add, but that’s not a problem.

Since it’s in a 1:2 aspect ratio I thought it might work without all this finagling, but anyway, I’m glad it works!

The code I ended up using:

[data-prefix="tnc_col_148_item_single"] .tainacan-media-component {
  --document-height: 1200px !important;
  --document-width: 800px !important;
}

[data-prefix="tnc_col_148_item_single"] .tainacan-media-component__swiper-main .swiper-slide-content .tainacan-content-embed {
    height: 1200px !important;
    width: 100% !important;
}
[data-prefix="tnc_col_148_item_single"] :not(.wp-block-embed__wrapper) > .tainacan-has-aspect-ratio .tainacan-content-embed__wrapper::before {
    padding-top: 0px !important;
}
[data-prefix="tnc_col_148_item_single"] :not(.wp-block-embed__wrapper) > .tainacan-content-embed .tainacan-content-embed__wrapper {
    position: initial !important;
}

Thank you again for all of the help!

How might I find out if the issue with the breadcrumbs is resolved natively?

1 curtida

Glad you could find a way :smiley:

You can subscribe to the GitHub issue. Once it is solved I’ll close it. We’re a bit busy with other stuff right now but one day I’ll take a look at it.

1 curtida

@alehandrof, I’m developing that breadcrumb feature. Can you test?

In the item page, if the cover page is enabled, the link to the collection should send you to the cover page.

@mateus.m.luna I uploaded the theme to /wp-content/themes and in the WP dashboard activated “Tainacan Support for Blocksy”. This resulted in breaking the site with this message: “There has been a critical error on this website.”

I’m new to WordPress, so do let me know if there’s something else I should’ve done instead :slight_smile:

Nooooo that is a plugin, not a theme :sweat_smile:

I hope you have access to your folder, I believe you do… if yes, then you can remove tainacan-blocksy from /wp-content/themes and then move it to wp-content/plugins. Let me know if this solves!

1 curtida

Ah, sorry about the mixup.

Yes, the breadcrumbs now support the cover page! That’s great, thank you!

On a somewhat related note, there are 2 pages with identical content:

  • https://repository.amicalnet.org/voices-of-pashtun-students/ (the original static page)
  • https://repository.amicalnet.org/collections/voices-of-pashtun-students-collection/ (a page created when I use the cover feature)

I’m not sure why the second page needs to be created at all, but thankfully its metadata points to the canonical URL (the first one), so it’s not really a problem. I just found it odd.

1 curtida

The second page “exists by default” in the WordPress permalinks structure it is the post type template/archive. We keep it accessible because the user may be interested on using the cover page to merely introduce some of the items using blocks and then leave a link to the full, complete faceted search list.