# Merge discourse-links-category into Discourse

**URL:** https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483
**Category:** Development
**Created:** [October 13, 2016, 5:33am UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483 "2016-10-13T05:33:31Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [October 13, 2016, 5:33am UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/1 "2016-10-13T05:33:31Z")

</div>

[https://meta.discourse.org/t/links-category-for-discourse/43532](https://meta.discourse.org/t/links-category-for-discourse/43532)

Links category is going to be a core feature. Links category offers the ability to post a link instead of text as well as displaying the link in the topic list. I’ll work together with the team for all its features. All features shall be working as original after the transition.

It adds an option in the category settings to be enabled. It stores links in the topic’s custom fields. A customized composer which shows only a small input field instead of original one is used to post link topics. The digest email template is also overrided for displaying url.

The implementation of plugins overrides many spots of core model which looks quite awkward to merge directly. I believe another archetype is much promising to try in the new implementation as [described here](https://meta.discourse.org/t/case-study-for-archetypes-questions-archetype/14527/13). But that should result in a lot of changes in composer model and post creator. I’d like to know whether it’s the right path to go. [@team](https://meta.discourse.org/groups/team)

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [October 17, 2016, 11:12am UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/2 "2016-10-17T11:12:59Z")

</div>

[@team](https://meta.discourse.org/groups/team) I think Erick is blocked on this without any feedback since he needs to know whether archetypes is the way to go or not before doing any significant work.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 17, 2016, 10:41pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/3 "2016-10-17T22:41:19Z")

</div>

I personally would rather prioritize this than Feature Voting, as it is more broadly useful to any Discourse site. But we’ll need to pick one – we don’t have anyone else to allocate at the moment.

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [October 18, 2016, 2:26pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/4 "2016-10-18T14:26:47Z")

</div>

If `archetype` is an expensive way to go, I can still merge the plugin in the core with the same implementation. It could be a bit messy in code. But I can improve later.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 19, 2016, 3:41am UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/5 "2016-10-19T03:41:39Z")

</div>

Adding an archetype construct is going to be a massive amount of work, I am not sure I am keen to take on that work right now.

Instead lets just extend plugin api to support what we need here if bits are missing

cc @eviltrout

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [October 19, 2016, 1:59pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/6 "2016-10-19T13:59:35Z")

</div>

I am curious what kinds of changes you’d need to the plugin api to support this?

You said the code goes deep into the model which sounds a bit scary.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 19, 2016, 9:50pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/7 "2016-10-19T21:50:58Z")

</div>

This should actually be merged into core, I don’t think this should be a plugin at all. Sharing a link and inviting discussion on that link is an essential feature for _all_ Discourse instances.

We’ll need to allocate someone for this work in the next few weeks.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [October 19, 2016, 9:55pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/8 "2016-10-19T21:55:35Z")

</div>

Should this be **by category** as it is today, or by topic as Reddit and HN?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [October 19, 2016, 10:13pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/9 "2016-10-19T22:13:43Z")

</div>

Probably by topic. I don’t think a whole category is needed. Some topics will be link based, others won’t.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [October 20, 2016, 3:49pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/11 "2016-10-20T15:49:34Z")

</div>

Also (sorry for being so specific) are we keeping the like OP on topic list? And only for link-type topics?

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [October 24, 2016, 3:24pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/12 "2016-10-24T15:24:05Z")

</div>

Sorry for my communication. I have arrived Sweden and there were things unexpected in the way ☹ I will make some progress this week.

> [@eviltrout](#):
>
> I am curious what kinds of changes you’d need to the plugin api to support this?
> 
> You said the code goes deep into the model which sounds a bit scary.

The code simply uses topic custom field so there are monkey patches in the ComposerController. And I also patched Topic and Composer model. To be merged to core with less work, sounds another model like `Warning` can do the trick.

As @sam asked, I will look for a way to extend Ember models to carry the field.

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [October 28, 2016, 6:18pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/13 "2016-10-28T18:18:23Z")

</div>

Well, a short progress report. It’s far more easy to inject the field in the core than writing this in a plugin. So far, using `TopicCustomField` is quite OK to make needed changes. Let me know if it conflicts anything.

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [November 10, 2016, 8:00pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/14 "2016-11-10T20:00:31Z")

</div>

Finally, the pull request is ready. It’s enabled by default for all topics if `topic_featured_link` setting is checked. However, there is a per-category’s option to restrict editing.

Posting topic with link:

 ![](https://global.discourse-cdn.com/meta/original/3X/8/2/82eab94d7d53a23ea972015f69ffec9e71c5ae96.gif)

Editing:

 ![](https://global.discourse-cdn.com/meta/original/3X/3/e/3ed7fc2e56818c13df77b99a508b9d995e64b0ca.gif)

Validation:

 ![](https://global.discourse-cdn.com/meta/original/3X/6/2/62316dbc92ffc3c0568173bcfbc23e15ebd57a90.gif)  
Validation is done by server end now. So there isn’t a popup like topic’s title.

Restricted in some categories:

 ![](https://global.discourse-cdn.com/meta/original/3X/a/8/a88e4d201fce75919776d8007991942b54d5368f.gif)

Either a site setting to turn off the raw here:

 ![](https://global.discourse-cdn.com/meta/original/3X/5/3/53cf837dbc35d19f4239e8ac1d065e573b59b410.gif)

The link is still stored in TopicCustomField which should be easy to migrate. There are some break changes. So I create a [new plugin](https://github.com/fantasticfears/discourse-topic-featured-link-extra) for those extra bits. This plugin can apply additional styles for links in digest email. Also there is a `topic_featured_link_extra_link_ref` for adding a ref parameters after the link. I’ll add showing onebox in the post body later.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [November 30, 2016, 9:55pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/15 "2016-11-30T21:55:13Z")

</div>

FYI I’m reviewing the PR now and hope to merge it soon. Soon!™

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [December 1, 2016, 9:22pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/16 "2016-12-01T21:22:16Z")

</div>

Some more shots.

Composer for **link-only style** and **onebox style** :

 ![](https://global.discourse-cdn.com/meta/original/3X/d/6/d65a5c04e17941ef90ecbd57b89830e5603e5daf.png)

## Topic for onebox style

 ![](https://global.discourse-cdn.com/meta/original/3X/b/d/bd3bb88886ef4264cbf1c25c5c9d4981cab9e7c4.png)

##Topic for link-only

 ![](https://global.discourse-cdn.com/meta/original/3X/1/0/1058f52758241a03f08416650c6c26926e9dd6f5.png)

I don’t know why anyone would prefer the link-only style. The first post body is blank, and the link is hard to spot.

Also, in topic lists the link-only should probably link the topic title to the link too, like Reddit does.

 ![](https://global.discourse-cdn.com/meta/original/3X/f/4/f4abf8103bf7009feee9aff173d141e0092f7b5d.png)

 ![](https://global.discourse-cdn.com/meta/original/3X/f/3/f37c1c961af2e1df3354db2268b57f479b50a30d.png)

Maybe that’s how it should work for all styles of “link topics”?

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [December 2, 2016, 6:23pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/20 "2016-12-02T18:23:30Z")

</div>

OK, I’ll remove link-only option. The empty body (without onebox) is the origin spec from @commonpawn since they are using a different design. It’s also easy to hide post body in CSS.

> [@neil](#):
>
> Also, in topic lists the link-only should probably link the topic title to the link too, like Reddit does.

[http://danskdynamit.com/](http://danskdynamit.com/) shows a button for clicking the links. It’s obvious as of functionality. But it’s too large for the official theme.

![](https://global.discourse-cdn.com/meta/original/3X/0/3/030d4427751b5ffef8e72736a5f02a9587fc8e23.jpg)

The only thing I am afraid is that it might be hard for beginners to find the comment area.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [December 2, 2016, 6:27pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/21 "2016-12-02T18:27:47Z")

</div>

> [@fantasticfears](#):
>
> The only thing I am afraid is that it might be hard for beginners to find the comment area.

Ok keep it as is. We can change it later based on feedback.

The only issue that needs fixing before we can merge is the exception thrown when trying to post in a category that doesn’t allow topic links.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [December 5, 2016, 9:42pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/22 "2016-12-05T21:42:24Z")

</div>

This work was merged today. Thank you @fantasticfears!

Some issues still to fix:

- Revision history of oneboxed links is showing newer versions of the onebox. `raw` and `cooked` aren’t being stored in the revisions.
- Some wording can still be improved.
- Composer with tags input needs fixin’.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [December 10, 2016, 8:55pm UTC](https://meta.discourse.org/t/merge-discourse-links-category-into-discourse/51483/23 "2016-12-10T20:55:18Z")

</div>

16 posts were split to a new topic: [Start a topic by pasting a link (like Reddit)](https://meta.discourse.org/t/start-a-topic-by-pasting-a-link-like-reddit/54071)
